Struct ouroboros_examples::ouroboros_impl_visibility::VisibilityAsyncTryBuilder[][src]

pub struct VisibilityAsyncTryBuilder<PublicFieldBuilder_: for<'this> FnOnce(&'this Box<i32>) -> Pin<Box<dyn Future<Output = Result<&'this i32, Error_>> + 'this>>, PubCrateFieldBuilder_: for<'this> FnOnce(&'this Box<i32>) -> Pin<Box<dyn Future<Output = Result<&'this i32, Error_>> + 'this>>, Error_> {
    pub private_field: Box<i32>,
    pub public_field_builder: PublicFieldBuilder_,
    pub pub_crate_field_builder: PubCrateFieldBuilder_,
}
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 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
private_fieldDirectly pass in the value this field should contain
public_field_builderUse a function or closure: (private_field: &_) -> Result<public_field: _, Error_>
pub_crate_field_builderUse a function or closure: (private_field: &_) -> Result<pub_crate_field: _, Error_>

Fields

private_field: Box<i32>public_field_builder: PublicFieldBuilder_pub_crate_field_builder: PubCrateFieldBuilder_

Implementations

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

Calls Visibility::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

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.