[−][src]Struct ouroboros_examples::ouroboros_impl_chain_hack::ChainHackBuilder
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: Box<i32>
b_builder: BBuilder_
c_builder: CBuilder_
Implementations
impl<BBuilder_: for<'this> FnOnce(&'this i32) -> Arc<&'this i32>, CBuilder_: for<'this> FnOnce(&'this &'this i32) -> Rc<&'this i32>> ChainHackBuilder<BBuilder_, CBuilder_>
[src]
pub(crate) fn build(self) -> ChainHack
[src]
Calls ChainHack::new()
using the provided values. This is preferrable over calling new()
directly for the reasons listed above.
Auto Trait Implementations
impl<BBuilder_, CBuilder_> RefUnwindSafe for ChainHackBuilder<BBuilder_, CBuilder_> where
BBuilder_: RefUnwindSafe,
CBuilder_: RefUnwindSafe,
[src]
BBuilder_: RefUnwindSafe,
CBuilder_: RefUnwindSafe,
impl<BBuilder_, CBuilder_> Send for ChainHackBuilder<BBuilder_, CBuilder_> where
BBuilder_: Send,
CBuilder_: Send,
[src]
BBuilder_: Send,
CBuilder_: Send,
impl<BBuilder_, CBuilder_> Sync for ChainHackBuilder<BBuilder_, CBuilder_> where
BBuilder_: Sync,
CBuilder_: Sync,
[src]
BBuilder_: Sync,
CBuilder_: Sync,
impl<BBuilder_, CBuilder_> Unpin for ChainHackBuilder<BBuilder_, CBuilder_> where
BBuilder_: Unpin,
CBuilder_: Unpin,
[src]
BBuilder_: Unpin,
CBuilder_: Unpin,
impl<BBuilder_, CBuilder_> UnwindSafe for ChainHackBuilder<BBuilder_, CBuilder_> where
BBuilder_: UnwindSafe,
CBuilder_: UnwindSafe,
[src]
BBuilder_: UnwindSafe,
CBuilder_: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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.
pub 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>,