general_wrapper

Macro general_wrapper 

Source
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).

wrapper_lite::general_wrapper!(
    #[derive(Debug, Clone, Copy)]
    pub struct ExampleWrapper<'a, P>(pub(crate) &'a P);
);

This is equivalent to using the wrapper! macro with the following attributes:

wrapper_lite::wrapper!(
    #[wrapper_impl(AsRef)]
    #[wrapper_impl(Borrow)]
    #[wrapper_impl(From)]
    #[derive(Debug, Clone, Copy)]
    pub struct ExampleWrapper<'a, P>(pub(crate) &'a P);
);

You can certainly add attributes like #[wrapper_impl(Deref)] other than the preset ones. See wrapper! for more details.

wrapper_lite::general_wrapper!(
    #[wrapper_impl(Deref)]
    #[derive(Debug, Clone, Copy)]
    pub struct ExampleWrapper<'a, P>(pub(crate) &'a P);
);