Take control of the Semver hazard of the `dyn` safety of your traits!
APACHE-2.0 License
::dyn_safe
dyn
safety of your traits!cargo add dyn_safe
, or add the following to your Cargo.toml
file:
[dependencies]
dyn_safe = "x.y.z"
cargo search dyn_safe
Add the following to your lib.rs
file:
#[macro_use]
extern crate dyn_safe;
Use #[dyn_safe(true)]
or #[dyn_safe(false)]
to, respectively,
assert that the trait object is dyn
-safe or that the trait
object should not be dyn
-safe.
#[macro_use]
extern crate dyn_safe;
#[dyn_safe(true)]
trait Foo {
fn whoops ();
}
#[macro_use]
extern crate dyn_safe;
#[dyn_safe(false)]
trait Foo {
// …
}
let _: dyn Foo; // Whoops