pub trait AlternativeFold {
// Required method
fn fold_or(self, outer: Self) -> Self;
}Expand description
A variant of fold for foldable optional (Option<T>) values where an inner
None value isn’t respected (contrary to Option’s usual Fold
implementation, with which folding with an inner None always returns
None). Instead, when either of the Option objects is None, the other
one is necessarily returned by fold_or. Normal folding still occurs when
both values are Some, using T’s Fold implementation.
This is useful when None in a particular context means “unspecified”
rather than “absent”, in which case a specified value (Some) is chosen
over an unspecified one (None), while two specified values are folded
together.
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.