Struct ouroboros_examples::ouroboros_impl_documentation_example::DocumentationExampleBuilder[][src]

pub(crate) struct DocumentationExampleBuilder<IntReferenceBuilder_: for<'this> FnOnce(&'this i32) -> &'this i32, FloatReferenceBuilder_: for<'this> FnOnce(&'this mut f32) -> &'this mut f32> {
    pub(crate) int_data: i32,
    pub(crate) float_data: f32,
    pub(crate) int_reference_builder: IntReferenceBuilder_,
    pub(crate) float_reference_builder: FloatReferenceBuilder_,
}
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:

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: &_) -> int_reference: _
float_reference_builderUse a function or closure: (float_data: &mut _) -> float_reference: _

Fields

int_data: i32float_data: f32int_reference_builder: IntReferenceBuilder_float_reference_builder: FloatReferenceBuilder_

Implementations

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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.