Struct fluent_builder::FluentBuilder
[−]
[src]
pub struct FluentBuilder<T> { /* fields omitted */ }
A structure that can contain a value, or stack mutating methods over one supplied later.
The FluentBuilder<T>
is effectively a StatefulFluentBuilder<T, ()>
.
Methods
impl<T> FluentBuilder<T>
[src]
fn new() -> Self
[src]
Create a default FluentBuilder
.
fn value(self, value: T) -> Self
[src]
Set a value on the builder.
This will override any contained state. That means if the builder currently contains fluent methods then those methods will be discarded.
fn into_value<F>(self, default_value: F) -> T where
F: Fn() -> T + 'static,
[src]
F: Fn() -> T + 'static,
Convert the fluent builder into a value.
This method will consume the builder and return a constructed T
.
This will have the following behaviour:
- If the builder contains no value or fluent methods, then the default value is constructed.
- If the builder contains a value, then that value is returned.
- If the builder contains no value but fluent methods, then the methods are applied over the default value.
- If the builder contains a value and fluent methods, then the methods are applied over that value.
impl<T> FluentBuilder<T> where
T: 'static,
[src]
T: 'static,
fn fluent<F>(self, fluent_method: F) -> Self where
F: FnOnce(T) -> T + 'static,
[src]
F: FnOnce(T) -> T + 'static,
Stack a fluent method on the builder.
This will have the following behaviour depending on the current state of the builder:
- If there is no previous value, add the fluent method. This will be applied to a later-supplied default value.
- If there is a previous value, add the fluent method and retain that previous value.
- If there is a previous fluent method, stack this method on top and retain any previous value.
fn fluent_mut<F>(self, fluent_method: F) -> Self where
F: FnOnce(&mut T) + 'static,
[src]
F: FnOnce(&mut T) + 'static,
Stack a fluent method on the builder.
This method behaves the same as fluent
, but mutates the value instead of replacing it.