Macro dyn_slice::declare_new_fns
source · declare_new_fns!() { /* proc-macro */ }
Expand description
Declare new
and new_mut
functions for dyn slices of a trait.
§Syntax
declare_new_fns!(
#[attributes]
pub name<parameters> Trait<arguments>
where
parameter: bounds,
);
The ptr_metadata
feature must be enabled to use this macro!
§Example: Display
#![feature(ptr_metadata)]
declare_new_fns!(
display_slice std::fmt::Display
);
§Other examples
There are more examples of how to use declare_new_fns
in the examples directory.
§Use from other crates
When using dyn_slice
from crates that re-export it, you may need to add a crate
attribute, for example:
declare_new_fns!(
#[crate = other_crate::dyn_slice]
name Trait
);