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: i32§float_data: f32§int_reference_builder: IntReferenceBuilder_§float_reference_builder: FloatReferenceBuilder_

Implementations§

source§

impl<IntReferenceBuilder_: for<'this> FnOnce(&'this i32) -> &'this i32, FloatReferenceBuilder_: for<'this> FnOnce(&'this mut f32) -> &'this mut f32> DocumentationExampleBuilder<IntReferenceBuilder_, FloatReferenceBuilder_>

source

pub(crate) fn build(self) -> DocumentationExample

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

Auto Trait Implementations§

§

impl<IntReferenceBuilder_, FloatReferenceBuilder_> RefUnwindSafe for DocumentationExampleBuilder<IntReferenceBuilder_, FloatReferenceBuilder_>
where FloatReferenceBuilder_: RefUnwindSafe, IntReferenceBuilder_: RefUnwindSafe,

§

impl<IntReferenceBuilder_, FloatReferenceBuilder_> Send for DocumentationExampleBuilder<IntReferenceBuilder_, FloatReferenceBuilder_>
where FloatReferenceBuilder_: Send, IntReferenceBuilder_: Send,

§

impl<IntReferenceBuilder_, FloatReferenceBuilder_> Sync for DocumentationExampleBuilder<IntReferenceBuilder_, FloatReferenceBuilder_>
where FloatReferenceBuilder_: Sync, IntReferenceBuilder_: Sync,

§

impl<IntReferenceBuilder_, FloatReferenceBuilder_> Unpin for DocumentationExampleBuilder<IntReferenceBuilder_, FloatReferenceBuilder_>
where FloatReferenceBuilder_: Unpin, IntReferenceBuilder_: Unpin,

§

impl<IntReferenceBuilder_, FloatReferenceBuilder_> UnwindSafe for DocumentationExampleBuilder<IntReferenceBuilder_, FloatReferenceBuilder_>
where FloatReferenceBuilder_: UnwindSafe, IntReferenceBuilder_: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.