Macro optics::impl_up_from
source · macro_rules! impl_up_from { ( [AffineTraversal] $( $name:ident as $base:ty => $target:ty $(, for <$($p:ident),+ $(,)?>)? );+ $(;)? ) => { ... }; ( [AffineFold(Mut)] $( $name:ident as $base:ty => $target:ty $(, for <$($p:ident),+ $(,)?>)? );+ $(;)? ) => { ... }; ( [Getter(Ref,Mut)] $( $name:ident as $base:ty => $target:ty $(, for <$($p:ident),+ $(,)?>)? );+ $(;)? ) => { ... }; }
Expand description
Implement the lens hierarchy from some specific level.
Base Trait | Free Implementation |
---|---|
AffineTraversal | Setter |
AffineFold , AffineFoldMut | Traversal , AffineTraversal |
Getter , GetterRef , GetterMut | AffineFold , AffineFoldRef , AffineFoldMut |
Call this in the following form:
ⓘ
impl_up_from! {
[BaseTrait]
OpticsName as BaseType => TargetType,
for<... generic parameters ...>;
// ... and perhaps more lines like this
}