Struct ouroboros_examples::ouroboros_impl_chain::ChainAsyncTryBuilder [−][src]
pub(crate) struct ChainAsyncTryBuilder<BBuilder_: for<'this> FnOnce(&'this i32) -> Pin<Box<dyn Future<Output = Result<&'this i32, Error_>> + 'this>>, CBuilder_: for<'this> FnOnce(&'this &'this i32) -> Pin<Box<dyn Future<Output = Result<&'this i32, Error_>> + 'this>>, Error_> { pub(crate) a: i32, pub(crate) b_builder: BBuilder_, pub(crate) c_builder: CBuilder_, }
Expand description
A more verbose but stable way to construct self-referencing structs. It is comparable to using StructName { field1: value1, field2: value2 }
rather than StructName::new(value1, value2)
. This has the dual benefit of makin your code both easier to refactor and more readable. Call try_build()
or try_build_or_recover()
to construct the actual struct. The fields of this struct should be used as follows:
Field | Suggested Use |
---|---|
a | Directly pass in the value this field should contain |
b_builder | Use a function or closure: (a: &_) -> Result<b: _, Error_> |
c_builder | Use a function or closure: (b: &_) -> Result<c: _, Error_> |
Fields
a: i32
b_builder: BBuilder_
c_builder: CBuilder_
Implementations
Calls Chain::try_new()
using the provided values. This is preferrable over calling try_new()
directly for the reasons listed above.
Calls Chain::try_new_or_recover()
using the provided values. This is preferrable over calling try_new_or_recover()
directly for the reasons listed above.
Auto Trait Implementations
impl<BBuilder_, CBuilder_, Error_> RefUnwindSafe for ChainAsyncTryBuilder<BBuilder_, CBuilder_, Error_> where
BBuilder_: RefUnwindSafe,
CBuilder_: RefUnwindSafe,
impl<BBuilder_, CBuilder_, Error_> Send for ChainAsyncTryBuilder<BBuilder_, CBuilder_, Error_> where
BBuilder_: Send,
CBuilder_: Send,
impl<BBuilder_, CBuilder_, Error_> Sync for ChainAsyncTryBuilder<BBuilder_, CBuilder_, Error_> where
BBuilder_: Sync,
CBuilder_: Sync,
impl<BBuilder_, CBuilder_, Error_> Unpin for ChainAsyncTryBuilder<BBuilder_, CBuilder_, Error_> where
BBuilder_: Unpin,
CBuilder_: Unpin,
impl<BBuilder_, CBuilder_, Error_> UnwindSafe for ChainAsyncTryBuilder<BBuilder_, CBuilder_, Error_> where
BBuilder_: UnwindSafe,
CBuilder_: UnwindSafe,