Skip to main content

Node

Enum Node 

Source
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 context C paired with error E, formatted by F (default Colon: "{context}: {error}").
  • Group: a Subgroup — a label GroupContext paired with the boxed nested ManyErrors. The label is formatted by GroupFormat (default AsDisplay: the label’s own Display); the nested errors’ layout is owned by the aggregate strategy, so GroupFormat is a label-only Format<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>

Source

pub fn is_leaf(&self) -> bool

Returns true if this is a Node::Leaf.

Source

pub fn as_leaf(&self) -> Option<&WithContext<C, E, F>>

Returns the leaf’s WithContext pair, or None for a group.

Source

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.

Source

pub fn with_formats<NewF, NewGF>(self) -> Node<C, E, GroupContext, NewF, NewGF>
where NewF: Format<WithContext<C, E, NewF>>, NewGF: Format<GroupContext>,

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> Clone for Node<C, E, GroupContext, F, GroupFormat>
where C: Clone, E: Clone, GroupContext: Clone,

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<C, E, GroupContext, F, GroupFormat> Debug for Node<C, E, GroupContext, F, GroupFormat>
where C: Debug, E: Debug, GroupContext: Debug,

Source§

fn fmt(&self, __f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<C, E, GroupContext, F, GroupFormat> Display for Node<C, E, GroupContext, F, GroupFormat>
where E: Error + 'static, F: Format<WithContext<C, E, F>>, GroupFormat: Format<GroupContext>,

Renders the child standalone: a leaf via its own WithContext Display (the pair through F), a group via Subgroup’s Display ("{label} (…shallow summary…)").

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<C, E, GroupContext, F, GroupFormat> Eq for Node<C, E, GroupContext, F, GroupFormat>
where C: Eq, E: Eq, GroupContext: Eq,

Source§

impl<C, E, GroupContext, F, GroupFormat> Error for Node<C, E, GroupContext, F, GroupFormat>
where C: Debug, GroupContext: Debug, E: Error + 'static, F: Format<WithContext<C, E, F>>, GroupFormat: Format<GroupContext>,

Source§

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

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
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.

Source§

fn extend<I: IntoIterator<Item = Node<C, E, GC, F, GF>>>(&mut self, iter: I)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<C, E, GroupContext, F, GroupFormat> From<(C, E)> for Node<C, E, GroupContext, F, GroupFormat>

Source§

fn from((context, error): (C, E)) -> Self

Converts to this type from the input type.
Source§

impl<C, E, GroupContext, F, GroupFormat> From<Subgroup<C, E, GroupContext, F, GroupFormat>> for Node<C, E, GroupContext, F, GroupFormat>

Source§

fn from(group: Subgroup<C, E, GroupContext, F, GroupFormat>) -> Self

Converts to this type from the input type.
Source§

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

Converts to this type from the input type.
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).

Source§

fn from_iter<I: IntoIterator<Item = Node<C, E, GC, F, GF>>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<C, E, GroupContext, F, GroupFormat> Hash for Node<C, E, GroupContext, F, GroupFormat>
where C: Hash, E: Hash, GroupContext: Hash,

Source§

fn hash<__H: Hasher>(&self, __state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<C, E, GroupContext, F, GroupFormat> PartialEq for Node<C, E, GroupContext, F, GroupFormat>
where C: PartialEq, E: PartialEq, GroupContext: PartialEq,

Source§

fn eq(&self, __other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

§

impl<C, E, GroupContext, F, GroupFormat> Freeze for Node<C, E, GroupContext, F, GroupFormat>
where C: Freeze, E: Freeze, GroupContext: Freeze,

§

impl<C, E, GroupContext, F, GroupFormat> RefUnwindSafe for Node<C, E, GroupContext, F, GroupFormat>
where C: RefUnwindSafe, E: RefUnwindSafe, GroupContext: RefUnwindSafe,

§

impl<C, E, GroupContext, F, GroupFormat> Send for Node<C, E, GroupContext, F, GroupFormat>
where C: Send, E: Send, GroupContext: Send,

§

impl<C, E, GroupContext, F, GroupFormat> Sync for Node<C, E, GroupContext, F, GroupFormat>
where C: Sync, E: Sync, GroupContext: Sync,

§

impl<C, E, GroupContext, F, GroupFormat> Unpin for Node<C, E, GroupContext, F, GroupFormat>
where C: Unpin, E: Unpin, GroupContext: Unpin,

§

impl<C, E, GroupContext, F, GroupFormat> UnsafeUnpin for Node<C, E, GroupContext, F, GroupFormat>
where C: UnsafeUnpin, E: UnsafeUnpin, GroupContext: UnsafeUnpin,

§

impl<C, E, GroupContext, F, GroupFormat> UnwindSafe for Node<C, E, GroupContext, F, GroupFormat>
where C: UnwindSafe, E: UnwindSafe, GroupContext: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<E> FormatError for E
where E: Error + ?Sized,

Source§

fn one_line(&self) -> Formatted<&Self, OneLine>

Formats the error in a single line concatenated by : .
Source§

fn chain(&self) -> Formatted<&Self, Chain>

Formats the error as an indented source-chain ladder. Read more
Source§

fn suggestion(&self) -> Formatted<&Self, Suggestion>
where Self: Suggest,

Renders the error’s Suggestion hint. Only the top-level error is printed; the source chain is not walked.
Source§

fn formatted<F>(&self) -> Formatted<&Self, F>

Formats the error using a custom Format strategy. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.