pub struct WithConstParamAsyncTryBuilder<T: 'static, const REV: bool, DrefBuilder_: for<'this> FnOnce(&'this RefCell<T>) -> Pin<Box<dyn Future<Output = Result<Option<Box<Ext<'this, T, REV>>>, Error_>> + 'this>>, Error_> {
    pub data: RefCell<T>,
    pub dref_builder: DrefBuilder_,
}
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:

FieldSuggested Use
dataDirectly pass in the value this field should contain
dref_builderUse a function or closure: (data: &_) -> Result<dref: _, Error_>

Fields§

§data: RefCell<T>§dref_builder: DrefBuilder_

Implementations§

source§

impl<T: 'static, const REV: bool, DrefBuilder_: for<'this> FnOnce(&'this RefCell<T>) -> Pin<Box<dyn Future<Output = Result<Option<Box<Ext<'this, T, REV>>>, Error_>> + 'this>>, Error_> WithConstParamAsyncTryBuilder<T, REV, DrefBuilder_, Error_>

source

pub async fn try_build(self) -> Result<WithConstParam<T, REV>, Error_>

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

source

pub async fn try_build_or_recover( self ) -> Result<WithConstParam<T, REV>, (Error_, Heads<T, REV>)>

Calls WithConstParam::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<T, const REV: bool, DrefBuilder_, Error_> !RefUnwindSafe for WithConstParamAsyncTryBuilder<T, REV, DrefBuilder_, Error_>

§

impl<T, const REV: bool, DrefBuilder_, Error_> Send for WithConstParamAsyncTryBuilder<T, REV, DrefBuilder_, Error_>
where DrefBuilder_: Send, T: Send,

§

impl<T, const REV: bool, DrefBuilder_, Error_> !Sync for WithConstParamAsyncTryBuilder<T, REV, DrefBuilder_, Error_>

§

impl<T, const REV: bool, DrefBuilder_, Error_> Unpin for WithConstParamAsyncTryBuilder<T, REV, DrefBuilder_, Error_>
where DrefBuilder_: Unpin, T: Unpin,

§

impl<T, const REV: bool, DrefBuilder_, Error_> UnwindSafe for WithConstParamAsyncTryBuilder<T, REV, DrefBuilder_, Error_>
where DrefBuilder_: UnwindSafe, T: 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.