pub struct WithConstParamTryBuilder<T: 'static, const REV: bool, DrefBuilder_: for<'this> FnOnce(&'this RefCell<T>) -> Result<Option<Box<Ext<'this, T, REV>>>, Error_>, 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>) -> Result<Option<Box<Ext<'this, T, REV>>>, Error_>, Error_> WithConstParamTryBuilder<T, REV, DrefBuilder_, Error_>
impl<T: 'static, const REV: bool, DrefBuilder_: for<'this> FnOnce(&'this RefCell<T>) -> Result<Option<Box<Ext<'this, T, REV>>>, Error_>, Error_> WithConstParamTryBuilder<T, REV, DrefBuilder_, Error_>
Sourcepub fn try_build(self) -> Result<WithConstParam<T, REV>, Error_>
pub 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 fn try_build_or_recover(
self,
) -> Result<WithConstParam<T, REV>, (Error_, Heads<T, REV>)>
pub 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_> !Freeze for WithConstParamTryBuilder<T, REV, DrefBuilder_, Error_>
impl<T, const REV: bool, DrefBuilder_, Error_> !RefUnwindSafe for WithConstParamTryBuilder<T, REV, DrefBuilder_, Error_>
impl<T, const REV: bool, DrefBuilder_, Error_> Send for WithConstParamTryBuilder<T, REV, DrefBuilder_, Error_>
impl<T, const REV: bool, DrefBuilder_, Error_> !Sync for WithConstParamTryBuilder<T, REV, DrefBuilder_, Error_>
impl<T, const REV: bool, DrefBuilder_, Error_> Unpin for WithConstParamTryBuilder<T, REV, DrefBuilder_, Error_>
impl<T, const REV: bool, DrefBuilder_, Error_> UnwindSafe for WithConstParamTryBuilder<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