macro_rules! general_wrapper {
($($tt:tt)+) => { ... };
}Expand description
Helper macro for creating a wrapper over any type (new-type idiom).
This is a shortcut for using the wrapper! macro with the most common impls
(AsRef, Borrow, From).
general_wrapper! {
#[derive(Debug, Clone, Copy)]
pub ExampleWrapper<'a, P>(pub(crate) &'a P)
}This is equivalent to using the wrapper! macro with the following
attributes:
wrapper! {
#[wrapper_impl(AsRef)]
#[wrapper_impl(Borrow)]
#[wrapper_impl(From)]
#[derive(Debug, Clone, Copy)]
pub ExampleWrapper<'a, P>(pub(crate) &'a P)
}You can certainly add attributes like #[wrapper_impl(Deref)] to implement
other traits based on the preset ones.
general_wrapper! {
#[wrapper_impl(Deref)]
#[derive(Debug, Clone, Copy)]
pub ExampleWrapper<'a, P>(pub(crate) &'a P)
}See wrapper! for more details.