pub struct When<'a, S> { /* private fields */ }
Expand description
Conditional combinator.
A When<S, R>
is returned from functions such as [CanEscape::when
] or [CanEscape::unless
] and allows to
continue chaining conditional statements, encoding the concept of else if
and else
in more traditional languages.
Implementations
sourceimpl<S> When<'_, S> where
S: DeepScope + Erased<Erased = ErasedScope>,
impl<S> When<'_, S> where
S: DeepScope + Erased<Erased = ErasedScope>,
sourcepub fn or(self, body: impl FnOnce(&mut S))
pub fn or(self, body: impl FnOnce(&mut S))
Add a final catch-all conditional branch — else
.
This method is often found chained after [CanEscape::when
] and allows to finish the chain of conditional
branches if the previous conditional fails (i.e. else
). The behavior is the same as with [CanEscape::when
].
Trait Implementations
Auto Trait Implementations
impl<'a, S> RefUnwindSafe for When<'a, S> where
S: RefUnwindSafe,
impl<'a, S> Send for When<'a, S> where
S: Send,
impl<'a, S> Sync for When<'a, S> where
S: Sync,
impl<'a, S> Unpin for When<'a, S>
impl<'a, S> !UnwindSafe for When<'a, S>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more