[−][src]Struct ouroboros_examples::ouroboros_impl_visibility::VisibilityTryBuilder
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 makin 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 |
---|---|
private_field | Directly pass in the value this field should contain |
public_field_builder | Use a function or closure: (private_field: &_) -> Result<public_field: _, Error_> |
pub_crate_field_builder | Use a function or closure: (private_field: &_) -> Result<pub_crate_field: _, Error_> |
Fields
private_field: Box<i32>
public_field_builder: PublicFieldBuilder_
pub_crate_field_builder: PubCrateFieldBuilder_
Implementations
impl<PublicFieldBuilder_: for<'this> FnOnce(&'this <Box<i32> as Deref>::Target) -> Result<&'this i32, Error_>, PubCrateFieldBuilder_: for<'this> FnOnce(&'this <Box<i32> as Deref>::Target) -> Result<&'this i32, Error_>, Error_> VisibilityTryBuilder<PublicFieldBuilder_, PubCrateFieldBuilder_, Error_>
[src]
pub fn try_build(self) -> Result<Visibility, Error_>
[src]
Calls Visibility::try_new()
using the provided values. This is preferrable over calling try_new()
directly for the reasons listed above.
pub fn try_build_or_recover(self) -> Result<Visibility, (Error_, Heads)>
[src]
Calls Visibility::try_new_or_recover()
using the provided values. This is preferrable over calling try_new_or_recover()
directly for the reasons listed above.
Auto Trait Implementations
impl<PublicFieldBuilder_, PubCrateFieldBuilder_, Error_> RefUnwindSafe for VisibilityTryBuilder<PublicFieldBuilder_, PubCrateFieldBuilder_, Error_> where
PubCrateFieldBuilder_: RefUnwindSafe,
PublicFieldBuilder_: RefUnwindSafe,
[src]
PubCrateFieldBuilder_: RefUnwindSafe,
PublicFieldBuilder_: RefUnwindSafe,
impl<PublicFieldBuilder_, PubCrateFieldBuilder_, Error_> Send for VisibilityTryBuilder<PublicFieldBuilder_, PubCrateFieldBuilder_, Error_> where
PubCrateFieldBuilder_: Send,
PublicFieldBuilder_: Send,
[src]
PubCrateFieldBuilder_: Send,
PublicFieldBuilder_: Send,
impl<PublicFieldBuilder_, PubCrateFieldBuilder_, Error_> Sync for VisibilityTryBuilder<PublicFieldBuilder_, PubCrateFieldBuilder_, Error_> where
PubCrateFieldBuilder_: Sync,
PublicFieldBuilder_: Sync,
[src]
PubCrateFieldBuilder_: Sync,
PublicFieldBuilder_: Sync,
impl<PublicFieldBuilder_, PubCrateFieldBuilder_, Error_> Unpin for VisibilityTryBuilder<PublicFieldBuilder_, PubCrateFieldBuilder_, Error_> where
PubCrateFieldBuilder_: Unpin,
PublicFieldBuilder_: Unpin,
[src]
PubCrateFieldBuilder_: Unpin,
PublicFieldBuilder_: Unpin,
impl<PublicFieldBuilder_, PubCrateFieldBuilder_, Error_> UnwindSafe for VisibilityTryBuilder<PublicFieldBuilder_, PubCrateFieldBuilder_, Error_> where
PubCrateFieldBuilder_: UnwindSafe,
PublicFieldBuilder_: UnwindSafe,
[src]
PubCrateFieldBuilder_: UnwindSafe,
PublicFieldBuilder_: 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,
pub 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.
pub 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>,