pub(crate) struct DocumentationExampleTryBuilder<IntReferenceBuilder_: for<'this> FnOnce(&'this i32) -> Result<&'this i32, Error_>, FloatReferenceBuilder_: for<'this> FnOnce(&'this mut f32) -> Result<&'this mut f32, Error_>, Error_> {
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 try_build() or try_build_or_recover() to construct the actual struct. The fields of this struct should be used as follows:
| Field | Suggested Use |
|---|---|
int_data | Directly pass in the value this field should contain |
float_data | Directly pass in the value this field should contain |
int_reference_builder | Use a function or closure: (int_data: &_) -> Result<int_reference: _, Error_> |
float_reference_builder | Use a function or closure: (float_data: &mut _) -> Result<float_reference: _, Error_> |
Fields§
§int_data: i32§float_data: f32§int_reference_builder: IntReferenceBuilder_§float_reference_builder: FloatReferenceBuilder_Implementations§
Source§impl<IntReferenceBuilder_: for<'this> FnOnce(&'this i32) -> Result<&'this i32, Error_>, FloatReferenceBuilder_: for<'this> FnOnce(&'this mut f32) -> Result<&'this mut f32, Error_>, Error_> DocumentationExampleTryBuilder<IntReferenceBuilder_, FloatReferenceBuilder_, Error_>
impl<IntReferenceBuilder_: for<'this> FnOnce(&'this i32) -> Result<&'this i32, Error_>, FloatReferenceBuilder_: for<'this> FnOnce(&'this mut f32) -> Result<&'this mut f32, Error_>, Error_> DocumentationExampleTryBuilder<IntReferenceBuilder_, FloatReferenceBuilder_, Error_>
Sourcepub(crate) fn try_build(self) -> Result<DocumentationExample, Error_>
pub(crate) fn try_build(self) -> Result<DocumentationExample, Error_>
Calls DocumentationExample::try_new() using the provided values. This is preferable over calling try_new() directly for the reasons listed above.
Sourcepub(crate) fn try_build_or_recover(
self,
) -> Result<DocumentationExample, (Error_, Heads)>
pub(crate) fn try_build_or_recover( self, ) -> Result<DocumentationExample, (Error_, Heads)>
Calls DocumentationExample::try_new_or_recover() using the provided values. This is preferable over calling try_new_or_recover() directly for the reasons listed above.
Auto Trait Implementations§
impl<IntReferenceBuilder_, FloatReferenceBuilder_, Error_> Freeze for DocumentationExampleTryBuilder<IntReferenceBuilder_, FloatReferenceBuilder_, Error_>
impl<IntReferenceBuilder_, FloatReferenceBuilder_, Error_> RefUnwindSafe for DocumentationExampleTryBuilder<IntReferenceBuilder_, FloatReferenceBuilder_, Error_>where
IntReferenceBuilder_: RefUnwindSafe,
FloatReferenceBuilder_: RefUnwindSafe,
impl<IntReferenceBuilder_, FloatReferenceBuilder_, Error_> Send for DocumentationExampleTryBuilder<IntReferenceBuilder_, FloatReferenceBuilder_, Error_>
impl<IntReferenceBuilder_, FloatReferenceBuilder_, Error_> Sync for DocumentationExampleTryBuilder<IntReferenceBuilder_, FloatReferenceBuilder_, Error_>
impl<IntReferenceBuilder_, FloatReferenceBuilder_, Error_> Unpin for DocumentationExampleTryBuilder<IntReferenceBuilder_, FloatReferenceBuilder_, Error_>
impl<IntReferenceBuilder_, FloatReferenceBuilder_, Error_> UnwindSafe for DocumentationExampleTryBuilder<IntReferenceBuilder_, FloatReferenceBuilder_, Error_>where
IntReferenceBuilder_: UnwindSafe,
FloatReferenceBuilder_: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more