| Crates.io | dyn_compatible |
| lib.rs | dyn_compatible |
| version | 0.1.4 |
| created_at | 2025-06-25 16:52:50.521528+00 |
| updated_at | 2025-07-15 12:38:13.419701+00 |
| description | Dyn compatible marker |
| homepage | |
| repository | https://github.com/nossie531/dyn_compatible |
| max_upload_size | |
| id | 1726167 |
| size | 20,440 |
Dyn compatible marker.
The author of this crate is not good at English.
Forgive me if the document is hard to read.
This crate provides marker to indicate wheather the trait is [dyn compatible]
or not. ("dyn compatible" is also called "object safe".)
It is important if trait is dyn compatible or not. However, Rust syntax
does not provide marker for it. Instead, it is determined from the kinds of
methods included in the trait. So, at code reading, we humans can't judge it
at a glance. Also, careless methods adding and removing to traits may result
in unexpected dyn compatibility change.
#[dyn_compatible(true)]
trait MyTrait {
fn some_method(&self);
}
For example, following two traits are ...
#[dyn_compatible(true)]
trait DynTrait {
fn some_method(&self);
}
#[dyn_compatible(false)]
trait NotDynTrait {
fn some_method(&self);
}
... expanded like these.
trait DynTrait {
fn some_method(&self);
}
impl dyn DynTrait {}
trait NotDynTrait: dyn_compatible::NotDyn {
fn some_method(&self);
}
See CHANGELOG.