Struct ouroboros_examples::ouroboros_impl_chain::ChainAsyncBuilder [−][src]
pub(crate) struct ChainAsyncBuilder<BBuilder_: for<'this> FnOnce(&'this i32) -> Pin<Box<dyn Future<Output = &'this i32> + 'this>>, CBuilder_: for<'this> FnOnce(&'this &'this i32) -> Pin<Box<dyn Future<Output = &'this i32> + 'this>>> {
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 making your code both easier to refactor and more readable. Call build()
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: &_) -> b: _ |
c_builder | Use a function or closure: (b: &_) -> c: _ |
Fields
a: i32
b_builder: BBuilder_
c_builder: CBuilder_
Implementations
Calls Chain::new()
using the provided values. This is preferrable over calling new()
directly for the reasons listed above.