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

Add a conditional branch — else if.

This method is often found chained after [CanEscape::when] and allows to add a new conditional if the previous conditional fails (i.e. else if). The behavior is the same as with [CanEscape::when].

Return

Another When<R>, allowing to add more conditional branches.

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

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.