pub enum Node<C, E, GroupContext = C, F = Colon, GroupFormat = AsDisplay> {
Leaf(WithContext<C, E, F>),
Group(Subgroup<C, E, GroupContext, F, GroupFormat>),
}Expand description
A child of a ManyErrors: either a leaf error paired with context, or a
named sub-group of further errors.
Each variant renders through its own Format strategy:
Leaf: a leaf contextCpaired with errorE, formatted byF(defaultColon:"{context}: {error}").Group: aSubgroup— a labelGroupContextpaired with the boxed nestedManyErrors. The label is formatted byGroupFormat(defaultAsDisplay: the label’s ownDisplay); the nested errors’ layout is owned by the aggregate strategy, soGroupFormatis a label-onlyFormat<GroupContext>and never touches them.
The standard-trait impls bound only C/E/GroupContext — never the F/GroupFormat marker
params (mirroring WithContext’s PhantomData<fn() -> F>).
Variants§
Leaf(WithContext<C, E, F>)
A leaf: one context-tagged error.
Group(Subgroup<C, E, GroupContext, F, GroupFormat>)
A named sub-group: a label paired with a boxed nested ManyErrors.
Implementations§
Source§impl<C, E, GroupContext, F, GroupFormat> Node<C, E, GroupContext, F, GroupFormat>
impl<C, E, GroupContext, F, GroupFormat> Node<C, E, GroupContext, F, GroupFormat>
Sourcepub fn is_leaf(&self) -> bool
pub fn is_leaf(&self) -> bool
Returns true if this is a Node::Leaf.
Sourcepub fn as_leaf(&self) -> Option<&WithContext<C, E, F>>
pub fn as_leaf(&self) -> Option<&WithContext<C, E, F>>
Returns the leaf’s WithContext pair, or None for a group.
Sourcepub fn as_group(&self) -> Option<&Subgroup<C, E, GroupContext, F, GroupFormat>>
pub fn as_group(&self) -> Option<&Subgroup<C, E, GroupContext, F, GroupFormat>>
Returns the group’s Subgroup, or None for a leaf.
The label is &self.context; the nested errors are &self.errors.
Sourcepub fn with_formats<NewF, NewGF>(self) -> Node<C, E, GroupContext, NewF, NewGF>
pub fn with_formats<NewF, NewGF>(self) -> Node<C, E, GroupContext, NewF, NewGF>
Switches the leaf and group-label strategies without touching the stored values (a group rebuilds its nested tree recursively).
Trait Implementations§
Source§impl<C, E, GroupContext, F, GroupFormat> Display for Node<C, E, GroupContext, F, GroupFormat>
Renders the child standalone: a leaf via its own WithContext Display
(the pair through F), a group via Subgroup’s Display
("{label} (…shallow summary…)").
impl<C, E, GroupContext, F, GroupFormat> Display for Node<C, E, GroupContext, F, GroupFormat>
Renders the child standalone: a leaf via its own WithContext Display
(the pair through F), a group via Subgroup’s Display
("{label} (…shallow summary…)").
impl<C, E, GroupContext, F, GroupFormat> Eq for Node<C, E, GroupContext, F, GroupFormat>
Source§impl<C, E, GroupContext, F, GroupFormat> Error for Node<C, E, GroupContext, F, GroupFormat>
impl<C, E, GroupContext, F, GroupFormat> Error for Node<C, E, GroupContext, F, GroupFormat>
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
A leaf delegates to WithContext’s source (which skips the inner
error itself — Display already shows it); a group returns None (an
aggregate of independent siblings has no single linear cause, matching
ManyErrors).
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl<C, E, GC, F, GF> Extend<Node<C, E, GC, F, GF>> for ManyErrors<C, E, GC, F, GF>
Appends arbitrary children — leaves and groups.
impl<C, E, GC, F, GF> Extend<Node<C, E, GC, F, GF>> for ManyErrors<C, E, GC, F, GF>
Appends arbitrary children — leaves and groups.
Source§fn extend<I: IntoIterator<Item = Node<C, E, GC, F, GF>>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = Node<C, E, GC, F, GF>>>(&mut self, iter: I)
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)Source§impl<C, E, GroupContext, F, GroupFormat> From<(C, E)> for Node<C, E, GroupContext, F, GroupFormat>
impl<C, E, GroupContext, F, GroupFormat> From<(C, E)> for Node<C, E, GroupContext, F, GroupFormat>
Source§impl<C, E, GroupContext, F, GroupFormat> From<Subgroup<C, E, GroupContext, F, GroupFormat>> for Node<C, E, GroupContext, F, GroupFormat>
impl<C, E, GroupContext, F, GroupFormat> From<Subgroup<C, E, GroupContext, F, GroupFormat>> for Node<C, E, GroupContext, F, GroupFormat>
Source§impl<C, E, GroupContext, F, GroupFormat> From<WithContext<C, E, F>> for Node<C, E, GroupContext, F, GroupFormat>
impl<C, E, GroupContext, F, GroupFormat> From<WithContext<C, E, F>> for Node<C, E, GroupContext, F, GroupFormat>
Source§fn from(w: WithContext<C, E, F>) -> Self
fn from(w: WithContext<C, E, F>) -> Self
Source§impl<C, E, GC, F, GF> FromIterator<Node<C, E, GC, F, GF>> for ManyErrors<C, E, GC, F, GF>
Builds an aggregate from arbitrary children — leaves and groups — so a
whole tree can be collected iteratively (unlike the leaf-only
WithContext/(C, E) impls).
impl<C, E, GC, F, GF> FromIterator<Node<C, E, GC, F, GF>> for ManyErrors<C, E, GC, F, GF>
Builds an aggregate from arbitrary children — leaves and groups — so a
whole tree can be collected iteratively (unlike the leaf-only
WithContext/(C, E) impls).
Auto Trait Implementations§
impl<C, E, GroupContext, F, GroupFormat> Freeze for Node<C, E, GroupContext, F, GroupFormat>
impl<C, E, GroupContext, F, GroupFormat> RefUnwindSafe for Node<C, E, GroupContext, F, GroupFormat>
impl<C, E, GroupContext, F, GroupFormat> Send for Node<C, E, GroupContext, F, GroupFormat>
impl<C, E, GroupContext, F, GroupFormat> Sync for Node<C, E, GroupContext, F, GroupFormat>
impl<C, E, GroupContext, F, GroupFormat> Unpin for Node<C, E, GroupContext, F, GroupFormat>
impl<C, E, GroupContext, F, GroupFormat> UnsafeUnpin for Node<C, E, GroupContext, F, GroupFormat>
impl<C, E, GroupContext, F, GroupFormat> UnwindSafe for Node<C, E, GroupContext, F, GroupFormat>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<E> FormatError for E
impl<E> FormatError for E
Source§fn one_line(&self) -> Formatted<&Self, OneLine>
fn one_line(&self) -> Formatted<&Self, OneLine>
: .Source§fn chain(&self) -> Formatted<&Self, Chain>
fn chain(&self) -> Formatted<&Self, Chain>
Source§fn suggestion(&self) -> Formatted<&Self, Suggestion>where
Self: Suggest,
fn suggestion(&self) -> Formatted<&Self, Suggestion>where
Self: Suggest,
Suggestion hint. Only the top-level error is
printed; the source chain is not walked.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>
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>
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