Skip to main content

FluentBuilder

Trait FluentBuilder 

Source
pub trait FluentBuilder {
    // Provided methods
    fn map<U>(self, f: impl FnOnce(Self) -> U) -> U
       where Self: Sized { ... }
    fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self
       where Self: Sized { ... }
    fn when_else(
        self,
        condition: bool,
        then: impl FnOnce(Self) -> Self,
        else_fn: impl FnOnce(Self) -> Self,
    ) -> Self
       where Self: Sized { ... }
    fn when_some<T>(
        self,
        option: Option<T>,
        then: impl FnOnce(Self, T) -> Self,
    ) -> Self
       where Self: Sized { ... }
    fn when_none<T>(
        self,
        option: &Option<T>,
        then: impl FnOnce(Self) -> Self,
    ) -> Self
       where Self: Sized { ... }
}
Expand description

A helper trait for building complex objects with imperative conditionals in a fluent style.

Provided Methods§

Source

fn map<U>(self, f: impl FnOnce(Self) -> U) -> U
where Self: Sized,

Imperatively modify self with the given closure.

Source

fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self
where Self: Sized,

Conditionally modify self with the given closure.

Source

fn when_else( self, condition: bool, then: impl FnOnce(Self) -> Self, else_fn: impl FnOnce(Self) -> Self, ) -> Self
where Self: Sized,

Conditionally modify self with the given closure.

Source

fn when_some<T>( self, option: Option<T>, then: impl FnOnce(Self, T) -> Self, ) -> Self
where Self: Sized,

Conditionally unwrap and modify self with the given closure, if the given option is Some.

Source

fn when_none<T>( self, option: &Option<T>, then: impl FnOnce(Self) -> Self, ) -> Self
where Self: Sized,

Conditionally unwrap and modify self with the given closure, if the given option is None.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl FluentBuilder for Column

Source§

impl FluentBuilder for EffectTransition

Source§

impl FluentBuilder for Notification

Source§

impl FluentBuilder for PopupMenu

Source§

impl FluentBuilder for PopupMenuItem

Source§

impl FluentBuilder for ScrollbarStyles

Source§

impl FluentBuilder for ScrollbarThumbStyle

Source§

impl FluentBuilder for ScrollbarTrackStyle

Source§

impl FluentBuilder for SidebarMenuItem

Source§

impl FluentBuilder for StateStyle

Source§

impl FluentBuilder for Tooltip

Implementors§

Source§

impl<T> FluentBuilder for T
where T: IntoElement,