[][src]Struct ouroboros_examples::DocumentationExampleTryBuilder

pub struct DocumentationExampleTryBuilder<IntReferenceBuilder_: for<'this> FnOnce(&'this <Box<i32> as Deref>::Target) -> Result<&'this i32, Error_>, FloatReferenceBuilder_: for<'this> FnOnce(&'this mut <Box<f32> as Deref>::Target) -> Result<&'this mut f32, Error_>, Error_> {
    pub int_data: Box<i32>,
    pub float_data: Box<f32>,
    pub int_reference_builder: IntReferenceBuilder_,
    pub float_reference_builder: FloatReferenceBuilder_,
}

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:

FieldSuggested Use
int_dataDirectly pass in the value this field should contain
float_dataDirectly pass in the value this field should contain
int_reference_builderUse a function or closure: (int_data: &_) -> Result<int_reference: _, Error_>
float_reference_builderUse a function or closure: (float_data: &mut _) -> Result<float_reference: _, Error_>

Fields

int_data: Box<i32>float_data: Box<f32>int_reference_builder: IntReferenceBuilder_float_reference_builder: FloatReferenceBuilder_

Implementations

impl<IntReferenceBuilder_: for<'this> FnOnce(&'this <Box<i32> as Deref>::Target) -> Result<&'this i32, Error_>, FloatReferenceBuilder_: for<'this> FnOnce(&'this mut <Box<f32> as Deref>::Target) -> Result<&'this mut f32, Error_>, Error_> DocumentationExampleTryBuilder<IntReferenceBuilder_, FloatReferenceBuilder_, Error_>[src]

pub fn try_build(self) -> Result<DocumentationExample, Error_>[src]

Calls DocumentationExample::try_new() using the provided values. This is preferrable over calling try_new() directly for the reasons listed above.

pub fn try_build_or_recover(
    self
) -> Result<DocumentationExample, (Error_, Heads)>
[src]

Calls DocumentationExample::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<IntReferenceBuilder_, FloatReferenceBuilder_, Error_> RefUnwindSafe for DocumentationExampleTryBuilder<IntReferenceBuilder_, FloatReferenceBuilder_, Error_> where
    FloatReferenceBuilder_: RefUnwindSafe,
    IntReferenceBuilder_: RefUnwindSafe

impl<IntReferenceBuilder_, FloatReferenceBuilder_, Error_> Send for DocumentationExampleTryBuilder<IntReferenceBuilder_, FloatReferenceBuilder_, Error_> where
    FloatReferenceBuilder_: Send,
    IntReferenceBuilder_: Send

impl<IntReferenceBuilder_, FloatReferenceBuilder_, Error_> Sync for DocumentationExampleTryBuilder<IntReferenceBuilder_, FloatReferenceBuilder_, Error_> where
    FloatReferenceBuilder_: Sync,
    IntReferenceBuilder_: Sync

impl<IntReferenceBuilder_, FloatReferenceBuilder_, Error_> Unpin for DocumentationExampleTryBuilder<IntReferenceBuilder_, FloatReferenceBuilder_, Error_> where
    FloatReferenceBuilder_: Unpin,
    IntReferenceBuilder_: Unpin

impl<IntReferenceBuilder_, FloatReferenceBuilder_, Error_> UnwindSafe for DocumentationExampleTryBuilder<IntReferenceBuilder_, FloatReferenceBuilder_, Error_> where
    FloatReferenceBuilder_: UnwindSafe,
    IntReferenceBuilder_: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.