pub struct ChoiceBuilder { /* private fields */ }Expand description
Builder for a .choice() … .end_choice() block.
Accumulates when clauses and an optional otherwise clause.
Cannot call .build() until .end_choice() is called.
Implementations§
Source§impl ChoiceBuilder
impl ChoiceBuilder
Sourcepub fn when<F>(self, predicate: F) -> WhenBuilder
pub fn when<F>(self, predicate: F) -> WhenBuilder
Open a when clause. Only exchanges matching predicate will be
processed by the steps inside the .when() … .end_when() scope.
Sourcepub fn otherwise(self) -> OtherwiseBuilder
pub fn otherwise(self) -> OtherwiseBuilder
Open an otherwise clause. Executed when no when predicate matched.
Only one otherwise is allowed per choice. Call this after all .when() clauses.
Sourcepub fn end_choice(self) -> RouteBuilder
pub fn end_choice(self) -> RouteBuilder
Close the choice scope. Packages all accumulated when clauses and
optional otherwise into a BuilderStep::Choice and returns the
parent RouteBuilder.
Auto Trait Implementations§
impl Freeze for ChoiceBuilder
impl !RefUnwindSafe for ChoiceBuilder
impl Send for ChoiceBuilder
impl !Sync for ChoiceBuilder
impl Unpin for ChoiceBuilder
impl UnsafeUnpin for ChoiceBuilder
impl !UnwindSafe for ChoiceBuilder
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
Mutably borrows from an owned value. Read more