Crates.io | dyn_safe-proc_macros |
lib.rs | dyn_safe-proc_macros |
version | 0.0.4 |
source | src |
created_at | 2020-11-20 20:27:25.741114 |
updated_at | 2022-07-17 12:07:28.145183 |
description | `::dyn_safe`'s internal crate. |
homepage | https://crates.io/crates/dyn_safe |
repository | https://github.com/danielhenrymantilla/dyn_safe.rs |
max_upload_size | |
id | 314447 |
size | 9,881 |
::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