pub(crate) struct DocumentationExampleAsyncBuilder<IntReferenceBuilder_: for<'this> FnOnce(&'this i32) -> Pin<Box<dyn Future<Output = &'this i32> + 'this>>, FloatReferenceBuilder_: for<'this> FnOnce(&'this mut f32) -> Pin<Box<dyn Future<Output = &'this mut f32> + 'this>>> {
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:
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: &_) -> int_reference: _ |
float_reference_builder | Use 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) -> Pin<Box<dyn Future<Output = &'this i32> + 'this>>, FloatReferenceBuilder_: for<'this> FnOnce(&'this mut f32) -> Pin<Box<dyn Future<Output = &'this mut f32> + 'this>>> DocumentationExampleAsyncBuilder<IntReferenceBuilder_, FloatReferenceBuilder_>
impl<IntReferenceBuilder_: for<'this> FnOnce(&'this i32) -> Pin<Box<dyn Future<Output = &'this i32> + 'this>>, FloatReferenceBuilder_: for<'this> FnOnce(&'this mut f32) -> Pin<Box<dyn Future<Output = &'this mut f32> + 'this>>> DocumentationExampleAsyncBuilder<IntReferenceBuilder_, FloatReferenceBuilder_>
Sourcepub(crate) async fn build(self) -> DocumentationExample
pub(crate) async 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_> Freeze for DocumentationExampleAsyncBuilder<IntReferenceBuilder_, FloatReferenceBuilder_>
impl<IntReferenceBuilder_, FloatReferenceBuilder_> RefUnwindSafe for DocumentationExampleAsyncBuilder<IntReferenceBuilder_, FloatReferenceBuilder_>where
IntReferenceBuilder_: RefUnwindSafe,
FloatReferenceBuilder_: RefUnwindSafe,
impl<IntReferenceBuilder_, FloatReferenceBuilder_> Send for DocumentationExampleAsyncBuilder<IntReferenceBuilder_, FloatReferenceBuilder_>
impl<IntReferenceBuilder_, FloatReferenceBuilder_> Sync for DocumentationExampleAsyncBuilder<IntReferenceBuilder_, FloatReferenceBuilder_>
impl<IntReferenceBuilder_, FloatReferenceBuilder_> Unpin for DocumentationExampleAsyncBuilder<IntReferenceBuilder_, FloatReferenceBuilder_>
impl<IntReferenceBuilder_, FloatReferenceBuilder_> UnwindSafe for DocumentationExampleAsyncBuilder<IntReferenceBuilder_, FloatReferenceBuilder_>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