[−][src]Struct fluent_builder::StatefulFluentBuilder
A stateful structure that can contain a value, or stack mutating methods over one supplied later.
Methods
impl<TSeed, TValue, TStack, TStorage> StatefulFluentBuilder<TSeed, TValue, TStack, TStorage> where
TStorage: Storage<TValue>,
[src]
TStorage: Storage<TValue>,
pub fn from_value(value: TValue) -> Self
[src]
Create a new StatefulFluentBuilder
from the given value.
pub fn from_seed(seed: TSeed) -> Self
[src]
Create a new StatefulFluentBuilder
from the given seed.
pub fn value(self, value: TValue) -> 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.
impl<TSeed, TValue, TStack> StatefulFluentBuilder<TSeed, TValue, TStack, DefaultStorage>
[src]
pub fn from_fluent<TNextStorage>(
seed: TSeed,
fluent_method: TNextStorage
) -> StatefulFluentBuilder<TSeed, TValue, TStack, Apply<TValue, DefaultStorage, ByValue<TNextStorage>>> where
TNextStorage: FnOnce(TValue) -> TValue,
[src]
seed: TSeed,
fluent_method: TNextStorage
) -> StatefulFluentBuilder<TSeed, TValue, TStack, Apply<TValue, DefaultStorage, ByValue<TNextStorage>>> where
TNextStorage: FnOnce(TValue) -> TValue,
Create a new StatefulFluentBuilder
from the given seed and fluent method.
pub fn from_fluent_mut<TNextStorage>(
seed: TSeed,
fluent_method: TNextStorage
) -> StatefulFluentBuilder<TSeed, TValue, TStack, Apply<TValue, DefaultStorage, ByRefMut<TNextStorage>>> where
TNextStorage: FnOnce(&mut TValue),
[src]
seed: TSeed,
fluent_method: TNextStorage
) -> StatefulFluentBuilder<TSeed, TValue, TStack, Apply<TValue, DefaultStorage, ByRefMut<TNextStorage>>> where
TNextStorage: FnOnce(&mut TValue),
Create a new StatefulFluentBuilder
from the given seed and fluent method.
This method is the same as from_fluent
, but mutates the value instead of replacing it.
impl<TSeed, TValue, TStack> StatefulFluentBuilder<TSeed, TValue, TStack, Shared>
[src]
pub fn from_fluent<TNextStorage>(
seed: TSeed,
fluent_method: TNextStorage
) -> StatefulFluentBuilder<TSeed, TValue, TStack, Shared> where
TValue: Send + 'static,
TSeed: Send + 'static,
TNextStorage: FnOnce(TValue) -> TValue + Send + 'static,
[src]
seed: TSeed,
fluent_method: TNextStorage
) -> StatefulFluentBuilder<TSeed, TValue, TStack, Shared> where
TValue: Send + 'static,
TSeed: Send + 'static,
TNextStorage: FnOnce(TValue) -> TValue + Send + 'static,
Create a new StatefulFluentBuilder
from the given seed and fluent method.
pub fn from_fluent_mut<TNextStorage>(
seed: TSeed,
fluent_method: TNextStorage
) -> StatefulFluentBuilder<TSeed, TValue, TStack, Shared> where
TValue: Send + 'static,
TSeed: Send + 'static,
TNextStorage: FnOnce(&mut TValue) + Send + 'static,
[src]
seed: TSeed,
fluent_method: TNextStorage
) -> StatefulFluentBuilder<TSeed, TValue, TStack, Shared> where
TValue: Send + 'static,
TSeed: Send + 'static,
TNextStorage: FnOnce(&mut TValue) + Send + 'static,
Create a new StatefulFluentBuilder
from the given seed and fluent method.
This method is the same as from_fluent
, but mutates the value instead of replacing it.
impl<TSeed, TValue, TStack> StatefulFluentBuilder<TSeed, TValue, TStack, Boxed>
[src]
pub fn from_fluent<TNextStorage>(
seed: TSeed,
fluent_method: TNextStorage
) -> StatefulFluentBuilder<TSeed, TValue, TStack, Boxed> where
TValue: 'static,
TSeed: 'static,
TNextStorage: FnOnce(TValue) -> TValue + 'static,
[src]
seed: TSeed,
fluent_method: TNextStorage
) -> StatefulFluentBuilder<TSeed, TValue, TStack, Boxed> where
TValue: 'static,
TSeed: 'static,
TNextStorage: FnOnce(TValue) -> TValue + 'static,
Create a new StatefulFluentBuilder
from the given seed and fluent method.
pub fn from_fluent_mut<TNextStorage>(
seed: TSeed,
fluent_method: TNextStorage
) -> StatefulFluentBuilder<TSeed, TValue, TStack, Boxed> where
TValue: 'static,
TSeed: 'static,
TNextStorage: FnOnce(&mut TValue) + 'static,
[src]
seed: TSeed,
fluent_method: TNextStorage
) -> StatefulFluentBuilder<TSeed, TValue, TStack, Boxed> where
TValue: 'static,
TSeed: 'static,
TNextStorage: FnOnce(&mut TValue) + 'static,
Create a new StatefulFluentBuilder
from the given seed and fluent method.
This method is the same as from_fluent
, but mutates the value instead of replacing it.
impl<TSeed, TValue, TStack, TStorage> StatefulFluentBuilder<TSeed, TValue, TStack, TStorage> where
TStorage: Storage<TValue>,
[src]
TStorage: Storage<TValue>,
pub fn into_value<TDefault>(self, default_value: TDefault) -> TValue where
TDefault: FnOnce(TSeed) -> TValue + 'static,
[src]
TDefault: FnOnce(TSeed) -> TValue + '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.
- a value, then that value is returned.
- no value but fluent methods, then the methods are applied over the default value.
- a value and fluent methods, then the methods are applied over that value.
pub fn try_into_value(self) -> TryIntoValue<TValue, Self>
[src]
Attempt to take a value from the builder.
If the builder doesn't contain a concrete value then it is returned in the Builder
variant.
Examples
let builder = StatefulFluentBuilder::<i32, String, Stack>::from_value("A value".to_owned()) .fluent(1, |i, s| format!("{} and more {}", s, i)); match builder.try_into_value() { TryIntoValue::Value(value) => { // The builder has a value that we can use assert_eq!("A value and more 1", value); }, TryIntoValue::Builder(builder) => { // The builder doesn't have a value but we can still use it let value = builder.into_value(|i| i.to_string()); } }
impl<TSeed, TValue, TStorage> StatefulFluentBuilder<TSeed, TValue, Stack, TStorage> where
TStorage: Storage<TValue>,
[src]
TStorage: Storage<TValue>,
pub fn fluent<TNextStorage>(
self,
seed: TSeed,
fluent_method: TNextStorage
) -> StatefulFluentBuilder<TSeed, TValue, Stack, StatefulApply<TSeed, TValue, TStorage::Method, ByValue<TNextStorage>>> where
TNextStorage: FnOnce(TSeed, TValue) -> TValue,
[src]
self,
seed: TSeed,
fluent_method: TNextStorage
) -> StatefulFluentBuilder<TSeed, TValue, Stack, StatefulApply<TSeed, TValue, TStorage::Method, ByValue<TNextStorage>>> where
TNextStorage: FnOnce(TSeed, TValue) -> TValue,
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.
- a previous value, add the fluent method and retain that previous value.
- a previous fluent method, stack this method on top and retain any previous value.
pub fn fluent_mut<TNextStorage>(
self,
seed: TSeed,
fluent_method: TNextStorage
) -> StatefulFluentBuilder<TSeed, TValue, Stack, StatefulApply<TSeed, TValue, TStorage::Method, ByRefMut<TNextStorage>>> where
TNextStorage: FnOnce(TSeed, &mut TValue),
[src]
self,
seed: TSeed,
fluent_method: TNextStorage
) -> StatefulFluentBuilder<TSeed, TValue, Stack, StatefulApply<TSeed, TValue, TStorage::Method, ByRefMut<TNextStorage>>> where
TNextStorage: FnOnce(TSeed, &mut TValue),
Stack a fluent method on the builder.
This method behaves the same as fluent
, but mutates the value instead of replacing it.
impl<TSeed, TValue, TStorage> StatefulFluentBuilder<TSeed, TValue, Override, TStorage> where
TStorage: Storage<TValue>,
[src]
TStorage: Storage<TValue>,
pub fn fluent<TNextStorage>(
self,
seed: TSeed,
fluent_method: TNextStorage
) -> StatefulFluentBuilder<TSeed, TValue, Override, Apply<TValue, DefaultStorage, ByValue<TNextStorage>>> where
TNextStorage: FnOnce(TValue) -> TValue + 'static,
[src]
self,
seed: TSeed,
fluent_method: TNextStorage
) -> StatefulFluentBuilder<TSeed, TValue, Override, Apply<TValue, DefaultStorage, ByValue<TNextStorage>>> where
TNextStorage: FnOnce(TValue) -> TValue + 'static,
Set the 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.
- a previous value, add the fluent method and remove that previous value.
- a previous fluent method, that method will be replaced with the given one.
pub fn fluent_mut<TNextStorage>(
self,
seed: TSeed,
fluent_method: TNextStorage
) -> StatefulFluentBuilder<TSeed, TValue, Override, Apply<TValue, DefaultStorage, ByRefMut<TNextStorage>>> where
TNextStorage: FnOnce(&mut TValue) + 'static,
[src]
self,
seed: TSeed,
fluent_method: TNextStorage
) -> StatefulFluentBuilder<TSeed, TValue, Override, Apply<TValue, DefaultStorage, ByRefMut<TNextStorage>>> where
TNextStorage: FnOnce(&mut TValue) + 'static,
Set the fluent method on the builder.
This method behaves the same as fluent
, but mutates the value instead of replacing it.
impl<TSeed, TValue, TStack, TStorage> StatefulFluentBuilder<TSeed, TValue, TStack, TStorage> where
TSeed: 'static,
TStorage: Storage<TValue>,
TStorage::Method: 'static,
[src]
TSeed: 'static,
TStorage: Storage<TValue>,
TStorage::Method: 'static,
pub fn boxed(self) -> BoxedStatefulFluentBuilder<TSeed, TValue, TStack>
[src]
Box a fluent builder so it can be easily captured as a field without generics.
impl<TSeed, TValue, TStack, TStorage> StatefulFluentBuilder<TSeed, TValue, TStack, TStorage> where
TSeed: 'static,
TStorage: Storage<TValue>,
TStorage::Method: Send + 'static,
[src]
TSeed: 'static,
TStorage: Storage<TValue>,
TStorage::Method: Send + 'static,
pub fn shared(self) -> SharedStatefulFluentBuilder<TSeed, TValue, TStack>
[src]
Box a fluent builder so it can be easily shared.
Auto Trait Implementations
impl<TSeed, TValue, TStack, TStorage> Send for StatefulFluentBuilder<TSeed, TValue, TStack, TStorage> where
TSeed: Send,
TStack: Send,
TValue: Send,
<TStorage as Storage<TValue>>::Method: Send,
TSeed: Send,
TStack: Send,
TValue: Send,
<TStorage as Storage<TValue>>::Method: Send,
impl<TSeed, TValue, TStack, TStorage> Sync for StatefulFluentBuilder<TSeed, TValue, TStack, TStorage> where
TSeed: Sync,
TStack: Sync,
TValue: Sync,
<TStorage as Storage<TValue>>::Method: Sync,
TSeed: Sync,
TStack: Sync,
TValue: Sync,
<TStorage as Storage<TValue>>::Method: Sync,
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,