pub enum Shape<N = ()> {
Base,
Optional(N, Box<Shape<N>>),
Iterable(Box<Shape<N>>),
}Expand description
A base leaf wrapped in zero or more Optional / Iterable layers, from the
inside out. N is the payload each Optional layer carries.
Variants§
Base
The leaf — no wrapping layers.
Optional(N, Box<Shape<N>>)
Option<…> layer over inner. meta is this layer’s payload.
Iterable(Box<Shape<N>>)
Vec<…> / List<…> layer over inner.
Implementations§
Source§impl<N> Shape<N>
impl<N> Shape<N>
Sourcepub fn optional(meta: N, inner: Shape<N>) -> Self
pub fn optional(meta: N, inner: Shape<N>) -> Self
Optional(meta, inner) without the explicit Box.
Sourcepub fn has_iterable_layer(&self) -> bool
pub fn has_iterable_layer(&self) -> bool
True when any layer of the stack is Iterable. This is the
fold-delivery discriminator: a fold surface (accumulator + per-element
callback) is selected whether or not Optional layers wrap the
iterable, and an iterable-shaped value has no single return.
Trait Implementations§
Auto Trait Implementations§
impl<N> Freeze for Shape<N>where
N: Freeze,
impl<N> RefUnwindSafe for Shape<N>where
N: RefUnwindSafe,
impl<N> Send for Shape<N>where
N: Send,
impl<N> Sync for Shape<N>where
N: Sync,
impl<N> Unpin for Shape<N>where
N: Unpin,
impl<N> UnsafeUnpin for Shape<N>where
N: UnsafeUnpin,
impl<N> UnwindSafe for Shape<N>where
N: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more