Struct ouroboros_examples::Visibility [−][src]
pub struct Visibility { /* fields omitted */ }
Implementations
Constructs a new instance of this self-referential struct. (See also VisibilityBuilder::build()
). Each argument is a field of the new struct. Fields that refer to other fields inside the struct are initialized using functions instead of directly passing their value. The arguments are as follows:
Argument | Suggested Use |
---|---|
private_field | Directly pass in the value this field should contain |
public_field_builder | Use a function or closure: (private_field: &_) -> public_field: _ |
pub_crate_field_builder | Use a function or closure: (private_field: &_) -> pub_crate_field: _ |
Constructs a new instance of this self-referential struct. (See also VisibilityAsyncBuilder::build()
). Each argument is a field of the new struct. Fields that refer to other fields inside the struct are initialized using functions instead of directly passing their value. The arguments are as follows:
Argument | Suggested Use |
---|---|
private_field | Directly pass in the value this field should contain |
public_field_builder | Use a function or closure: (private_field: &_) -> public_field: _ |
pub_crate_field_builder | Use a function or closure: (private_field: &_) -> pub_crate_field: _ |
(See also VisibilityTryBuilder::try_build()
.) Like new
, but builders for self-referencing fields can return results. If any of them fail, Err
is returned. If all of them succeed, Ok
is returned. The arguments are as follows:
Argument | 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_> |
(See also VisibilityTryBuilder::try_build_or_recover()
.) Like try_new
, but all head fields are returned in the case of an error. The arguments are as follows:
Argument | 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_> |
pub async fn try_new_async<Error_>(
private_field: Box<i32>,
public_field_builder: impl for<'this> FnOnce(&'this Box<i32>) -> Pin<Box<dyn Future<Output = Result<&'this i32, Error_>> + 'this>>,
pub_crate_field_builder: impl for<'this> FnOnce(&'this Box<i32>) -> Pin<Box<dyn Future<Output = Result<&'this i32, Error_>> + 'this>>
) -> Result<Visibility, Error_>
pub async fn try_new_async<Error_>(
private_field: Box<i32>,
public_field_builder: impl for<'this> FnOnce(&'this Box<i32>) -> Pin<Box<dyn Future<Output = Result<&'this i32, Error_>> + 'this>>,
pub_crate_field_builder: impl for<'this> FnOnce(&'this Box<i32>) -> Pin<Box<dyn Future<Output = Result<&'this i32, Error_>> + 'this>>
) -> Result<Visibility, Error_>
(See also VisibilityAsyncTryBuilder::try_build()
.) Like new
, but builders for self-referencing fields can return results. If any of them fail, Err
is returned. If all of them succeed, Ok
is returned. The arguments are as follows:
Argument | 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_> |
pub async fn try_new_or_recover_async<Error_>(
private_field: Box<i32>,
public_field_builder: impl for<'this> FnOnce(&'this Box<i32>) -> Pin<Box<dyn Future<Output = Result<&'this i32, Error_>> + 'this>>,
pub_crate_field_builder: impl for<'this> FnOnce(&'this Box<i32>) -> Pin<Box<dyn Future<Output = Result<&'this i32, Error_>> + 'this>>
) -> Result<Visibility, (Error_, Heads)>
pub async fn try_new_or_recover_async<Error_>(
private_field: Box<i32>,
public_field_builder: impl for<'this> FnOnce(&'this Box<i32>) -> Pin<Box<dyn Future<Output = Result<&'this i32, Error_>> + 'this>>,
pub_crate_field_builder: impl for<'this> FnOnce(&'this Box<i32>) -> Pin<Box<dyn Future<Output = Result<&'this i32, Error_>> + 'this>>
) -> Result<Visibility, (Error_, Heads)>
(See also VisibilityAsyncTryBuilder::try_build_or_recover()
.) Like try_new
, but all head fields are returned in the case of an error. The arguments are as follows:
Argument | 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_> |
pub(crate) fn with_private_field<'outer_borrow, ReturnType>(
&'outer_borrow self,
user: impl for<'this> FnOnce(&'outer_borrow Box<i32>) -> ReturnType
) -> ReturnType
pub(crate) fn with_private_field<'outer_borrow, ReturnType>(
&'outer_borrow self,
user: impl for<'this> FnOnce(&'outer_borrow Box<i32>) -> ReturnType
) -> ReturnType
Provides limited immutable access to private_field
. This method was generated because the contents of private_field
are immutably borrowed by other fields.
Provides limited immutable access to private_field
. This method was generated because the contents of private_field
are immutably borrowed by other fields.
pub fn with_public_field<'outer_borrow, ReturnType>(
&'outer_borrow self,
user: impl for<'this> FnOnce(&'outer_borrow &'this i32) -> ReturnType
) -> ReturnType
pub fn with_public_field<'outer_borrow, ReturnType>(
&'outer_borrow self,
user: impl for<'this> FnOnce(&'outer_borrow &'this i32) -> ReturnType
) -> ReturnType
Provides an immutable reference to public_field
. This method was generated because public_field
is a tail field.
Provides an immutable reference to public_field
. This method was generated because public_field
is a tail field.
pub fn with_public_field_mut<'outer_borrow, ReturnType>(
&'outer_borrow mut self,
user: impl for<'this> FnOnce(&'outer_borrow mut &'this i32) -> ReturnType
) -> ReturnType
pub fn with_public_field_mut<'outer_borrow, ReturnType>(
&'outer_borrow mut self,
user: impl for<'this> FnOnce(&'outer_borrow mut &'this i32) -> ReturnType
) -> ReturnType
Provides a mutable reference to public_field
. This method was generated because public_field
is a tail field. No borrow_public_field_mut
function was generated because Rust’s borrow checker is currently unable to guarantee that such a method would be used safely.
pub(crate) fn with_pub_crate_field<'outer_borrow, ReturnType>(
&'outer_borrow self,
user: impl for<'this> FnOnce(&'outer_borrow &'this i32) -> ReturnType
) -> ReturnType
pub(crate) fn with_pub_crate_field<'outer_borrow, ReturnType>(
&'outer_borrow self,
user: impl for<'this> FnOnce(&'outer_borrow &'this i32) -> ReturnType
) -> ReturnType
Provides an immutable reference to pub_crate_field
. This method was generated because pub_crate_field
is a tail field.
Provides an immutable reference to pub_crate_field
. This method was generated because pub_crate_field
is a tail field.
pub(crate) fn with_pub_crate_field_mut<'outer_borrow, ReturnType>(
&'outer_borrow mut self,
user: impl for<'this> FnOnce(&'outer_borrow mut &'this i32) -> ReturnType
) -> ReturnType
pub(crate) fn with_pub_crate_field_mut<'outer_borrow, ReturnType>(
&'outer_borrow mut self,
user: impl for<'this> FnOnce(&'outer_borrow mut &'this i32) -> ReturnType
) -> ReturnType
Provides a mutable reference to pub_crate_field
. This method was generated because pub_crate_field
is a tail field. No borrow_pub_crate_field_mut
function was generated because Rust’s borrow checker is currently unable to guarantee that such a method would be used safely.
pub fn with<'outer_borrow, ReturnType>(
&'outer_borrow self,
user: impl for<'this> FnOnce(BorrowedFields<'outer_borrow, 'this>) -> ReturnType
) -> ReturnType
pub fn with<'outer_borrow, ReturnType>(
&'outer_borrow self,
user: impl for<'this> FnOnce(BorrowedFields<'outer_borrow, 'this>) -> ReturnType
) -> ReturnType
This method provides immutable references to all tail and immutably borrowed fields.
pub fn with_mut<'outer_borrow, ReturnType>(
&'outer_borrow mut self,
user: impl for<'this> FnOnce(BorrowedMutFields<'outer_borrow, 'this>) -> ReturnType
) -> ReturnType
pub fn with_mut<'outer_borrow, ReturnType>(
&'outer_borrow mut self,
user: impl for<'this> FnOnce(BorrowedMutFields<'outer_borrow, 'this>) -> ReturnType
) -> ReturnType
This method provides mutable references to all tail fields.
This function drops all internally referencing fields and returns only the head fields of this struct.