Struct fluent_builder::StatefulFluentBuilder
[−]
[src]
pub struct StatefulFluentBuilder<T, S> { /* fields omitted */ }
A stateful structure that can contain a value, or stack mutating methods over one supplied later.
Methods
impl<T, S> StatefulFluentBuilder<T, S>
[src]
fn from_value(value: T) -> Self
[src]
Create a new StatefulFlientBuilder
from the given value.
fn from_seed(seed: S) -> Self
[src]
Create a new StatefulFlientBuilder
from the given seed.
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(S) -> T + 'static,
[src]
F: Fn(S) -> 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, S> StatefulFluentBuilder<T, S> where
T: 'static,
S: 'static,
[src]
T: 'static,
S: 'static,
fn from_fluent<F>(seed: S, fluent_method: F) -> Self where
F: FnOnce(T) -> T + 'static,
[src]
F: FnOnce(T) -> T + 'static,
Create a new StatefulFlientBuilder
from the given seed and fluent method.
fn from_fluent_mut<F>(seed: S, fluent_method: F) -> Self where
F: FnOnce(&mut T) + 'static,
[src]
F: FnOnce(&mut T) + 'static,
Create a new StatefulFlientBuilder
from the given seed and fluent method.
This method is the same as from_fluent
, but mutates the value instead of replacing it.
fn fluent<F>(self, seed: S, fluent_method: F) -> Self where
F: FnOnce(T, S) -> T + 'static,
[src]
F: FnOnce(T, S) -> 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, seed: S, fluent_method: F) -> Self where
F: FnOnce(&mut T, S) + 'static,
[src]
F: FnOnce(&mut T, S) + 'static,
Stack a fluent method on the builder.
This method behaves the same as fluent
, but mutates the value instead of replacing it.