builder-pattern 0.4.2

A derivable macro for declaring a builder pattern.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#[cfg(feature = "future")]
use futures::future::LocalBoxFuture;

pub enum Setter<'a, T> {
    Value(T),
    Lazy(Box<dyn 'a + FnOnce() -> T>),
    LazyValidated(Box<dyn 'a + FnOnce() -> Result<T, &'static str>>),
    #[cfg(feature = "future")]
    Async(Box<dyn 'a + FnOnce() -> LocalBoxFuture<'a, T>>),
    #[cfg(feature = "future")]
    AsyncValidated(Box<dyn 'a + FnOnce() -> LocalBoxFuture<'a, Result<T, &'static str>>>),
}

pub struct AsyncBuilderMarker {}

pub struct HavingLazyValidator {}