[−][src]Struct ouroboros_examples::BoxAndRefBuilder
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 |
data_ref_builder | Use a function or closure: (data: &_) -> data_ref: _ |
Fields
data: Box<i32>
data_ref_builder: DataRefBuilder_
Implementations
impl<DataRefBuilder_: for<'this> FnOnce(&'this <Box<i32> as Deref>::Target) -> &'this i32> BoxAndRefBuilder<DataRefBuilder_>
[src]
pub fn build(self) -> BoxAndRef
[src]
Calls BoxAndRef::new()
using the provided values. This is preferrable over calling new()
directly for the reasons listed above.
Auto Trait Implementations
impl<DataRefBuilder_> RefUnwindSafe for BoxAndRefBuilder<DataRefBuilder_> where
DataRefBuilder_: RefUnwindSafe,
DataRefBuilder_: RefUnwindSafe,
impl<DataRefBuilder_> Send for BoxAndRefBuilder<DataRefBuilder_> where
DataRefBuilder_: Send,
DataRefBuilder_: Send,
impl<DataRefBuilder_> Sync for BoxAndRefBuilder<DataRefBuilder_> where
DataRefBuilder_: Sync,
DataRefBuilder_: Sync,
impl<DataRefBuilder_> Unpin for BoxAndRefBuilder<DataRefBuilder_> where
DataRefBuilder_: Unpin,
DataRefBuilder_: Unpin,
impl<DataRefBuilder_> UnwindSafe for BoxAndRefBuilder<DataRefBuilder_> where
DataRefBuilder_: UnwindSafe,
DataRefBuilder_: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,