Macro galemu::create_gal_wrapper_type
source · macro_rules! create_gal_wrapper_type {
( $(#[$attr:meta])* $v:vis struct $Type:ident ($Inner:ident<$lt:tt>); ) => { ... };
}
Expand description
Creates a wrapper type for a type with a single lifetime parameter lifting the lifetime to Bound
.
The new type will have:
- A safe
new
method accepting a instance of the wrapped type with a lifetime'a
and returns aBound<'a, WrapperType>
. - Impl for
BoundExt
incl,BoundExt::pre_drop
(the wrapper doesn’t need aDrop
impl.). - A
get
function which accept&Bound<'a, WrapperType>
and returns a&WrappedType<'a>
. - A
get_mut
function which accepts&mut Bound<'a, WrapperType>
and returns a&mut WrappedType<'a>
. - A
into_inner
function which accpets aBound<'a, WrapperType>
and returns aWrappedType<'a>
.
Note that all the above functions are implemented on the wrapper type, i.e. you can’t be generic over them (at last not without generic associated lifetimes).
Example
See module level documentation.