Crates.io | dyn_safe |
lib.rs | dyn_safe |
version | 0.0.4 |
source | src |
created_at | 2020-11-20 20:27:42.762297 |
updated_at | 2022-07-17 12:08:01.913071 |
description | Take control of the Semver hazard of the `dyn` safety of your traits! |
homepage | https://crates.io/crates/dyn_safe |
repository | https://github.com/danielhenrymantilla/dyn_safe.rs |
max_upload_size | |
id | 314448 |
size | 20,140 |
::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