pub struct WithConstParamAsyncBuilder<T: 'static, const REV: bool, DrefBuilder_: for<'this> FnOnce(&'this RefCell<T>) -> Pin<Box<dyn Future<Output = Option<Box<Ext<'this, T, REV>>>> + 'this>>> {
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 build()
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: &_) -> dref: _ |
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 = Option<Box<Ext<'this, T, REV>>>> + 'this>>> WithConstParamAsyncBuilder<T, REV, DrefBuilder_>
impl<T: 'static, const REV: bool, DrefBuilder_: for<'this> FnOnce(&'this RefCell<T>) -> Pin<Box<dyn Future<Output = Option<Box<Ext<'this, T, REV>>>> + 'this>>> WithConstParamAsyncBuilder<T, REV, DrefBuilder_>
sourcepub async fn build(self) -> WithConstParam<T, REV>
pub async fn build(self) -> WithConstParam<T, REV>
Calls WithConstParam::new()
using the provided values. This is preferable over calling new()
directly for the reasons listed above.
Auto Trait Implementations§
impl<T, const REV: bool, DrefBuilder_> !RefUnwindSafe for WithConstParamAsyncBuilder<T, REV, DrefBuilder_>
impl<T, const REV: bool, DrefBuilder_> Send for WithConstParamAsyncBuilder<T, REV, DrefBuilder_>
impl<T, const REV: bool, DrefBuilder_> !Sync for WithConstParamAsyncBuilder<T, REV, DrefBuilder_>
impl<T, const REV: bool, DrefBuilder_> Unpin for WithConstParamAsyncBuilder<T, REV, DrefBuilder_>
impl<T, const REV: bool, DrefBuilder_> UnwindSafe for WithConstParamAsyncBuilder<T, REV, DrefBuilder_>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