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:
Field | Suggested Use |
---|---|
data | Directly pass in the value this field should contain |
dref_builder | Use 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_>
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_>
sourcepub async fn try_build(self) -> Result<WithConstParam<T, REV>, Error_>
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.
sourcepub async fn try_build_or_recover(
self
) -> Result<WithConstParam<T, REV>, (Error_, Heads<T, REV>)>
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_>
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_>
impl<T, const REV: bool, DrefBuilder_, Error_> UnwindSafe for WithConstParamAsyncTryBuilder<T, REV, DrefBuilder_, Error_>where
DrefBuilder_: UnwindSafe,
T: 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