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
newmethod accepting a instance of the wrapped type with a lifetime'aand returns aBound<'a, WrapperType>. - Impl for
BoundExtincl,BoundExt::pre_drop(the wrapper doesn’t need aDropimpl.). - A
getfunction which accept&Bound<'a, WrapperType>and returns a&WrappedType<'a>. - A
get_mutfunction which accepts&mut Bound<'a, WrapperType>and returns a&mut WrappedType<'a>. - A
into_innerfunction 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.