Struct ouroboros_examples::DocumentationExample
source · #[repr(transparent)]pub struct DocumentationExample {
actual_data: MaybeUninit<DocumentationExampleInternal>,
}
Expand description
The self-referencing struct.
Fields§
§actual_data: MaybeUninit<DocumentationExampleInternal>
Implementations§
source§impl DocumentationExample
impl DocumentationExample
sourcepub(crate) fn new(
int_data: i32,
float_data: f32,
int_reference_builder: impl for<'this> FnOnce(&'this i32) -> &'this i32,
float_reference_builder: impl for<'this> FnOnce(&'this mut f32) -> &'this mut f32
) -> DocumentationExample
pub(crate) fn new( int_data: i32, float_data: f32, int_reference_builder: impl for<'this> FnOnce(&'this i32) -> &'this i32, float_reference_builder: impl for<'this> FnOnce(&'this mut f32) -> &'this mut f32 ) -> DocumentationExample
Constructs a new instance of this self-referential struct. (See also DocumentationExampleBuilder::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 |
---|---|
int_data | Directly pass in the value this field should contain |
float_data | Directly pass in the value this field should contain |
int_reference_builder | Use a function or closure: (int_data: &_) -> int_reference: _ |
float_reference_builder | Use a function or closure: (float_data: &mut _) -> float_reference: _ |
sourcepub(crate) async fn new_async(
int_data: i32,
float_data: f32,
int_reference_builder: impl for<'this> FnOnce(&'this i32) -> Pin<Box<dyn Future<Output = &'this i32> + 'this>>,
float_reference_builder: impl for<'this> FnOnce(&'this mut f32) -> Pin<Box<dyn Future<Output = &'this mut f32> + 'this>>
) -> DocumentationExample
pub(crate) async fn new_async( int_data: i32, float_data: f32, int_reference_builder: impl for<'this> FnOnce(&'this i32) -> Pin<Box<dyn Future<Output = &'this i32> + 'this>>, float_reference_builder: impl for<'this> FnOnce(&'this mut f32) -> Pin<Box<dyn Future<Output = &'this mut f32> + 'this>> ) -> DocumentationExample
Constructs a new instance of this self-referential struct. (See also DocumentationExampleAsyncBuilder::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 |
---|---|
int_data | Directly pass in the value this field should contain |
float_data | Directly pass in the value this field should contain |
int_reference_builder | Use a function or closure: (int_data: &_) -> int_reference: _ |
float_reference_builder | Use a function or closure: (float_data: &mut _) -> float_reference: _ |
sourcepub(crate) async fn new_async_send(
int_data: i32,
float_data: f32,
int_reference_builder: impl for<'this> FnOnce(&'this i32) -> Pin<Box<dyn Future<Output = &'this i32> + Send + 'this>>,
float_reference_builder: impl for<'this> FnOnce(&'this mut f32) -> Pin<Box<dyn Future<Output = &'this mut f32> + Send + 'this>>
) -> DocumentationExample
pub(crate) async fn new_async_send( int_data: i32, float_data: f32, int_reference_builder: impl for<'this> FnOnce(&'this i32) -> Pin<Box<dyn Future<Output = &'this i32> + Send + 'this>>, float_reference_builder: impl for<'this> FnOnce(&'this mut f32) -> Pin<Box<dyn Future<Output = &'this mut f32> + Send + 'this>> ) -> DocumentationExample
Constructs a new instance of this self-referential struct. (See also DocumentationExampleAsyncSendBuilder::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 |
---|---|
int_data | Directly pass in the value this field should contain |
float_data | Directly pass in the value this field should contain |
int_reference_builder | Use a function or closure: (int_data: &_) -> int_reference: _ |
float_reference_builder | Use a function or closure: (float_data: &mut _) -> float_reference: _ |
sourcepub(crate) fn try_new<Error_>(
int_data: i32,
float_data: f32,
int_reference_builder: impl for<'this> FnOnce(&'this i32) -> Result<&'this i32, Error_>,
float_reference_builder: impl for<'this> FnOnce(&'this mut f32) -> Result<&'this mut f32, Error_>
) -> Result<DocumentationExample, Error_>
pub(crate) fn try_new<Error_>( int_data: i32, float_data: f32, int_reference_builder: impl for<'this> FnOnce(&'this i32) -> Result<&'this i32, Error_>, float_reference_builder: impl for<'this> FnOnce(&'this mut f32) -> Result<&'this mut f32, Error_> ) -> Result<DocumentationExample, Error_>
(See also DocumentationExampleTryBuilder::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 |
---|---|
int_data | Directly pass in the value this field should contain |
float_data | Directly pass in the value this field should contain |
int_reference_builder | Use a function or closure: (int_data: &_) -> Result<int_reference: _, Error_> |
float_reference_builder | Use a function or closure: (float_data: &mut _) -> Result<float_reference: _, Error_> |
sourcepub(crate) fn try_new_or_recover<Error_>(
int_data: i32,
float_data: f32,
int_reference_builder: impl for<'this> FnOnce(&'this i32) -> Result<&'this i32, Error_>,
float_reference_builder: impl for<'this> FnOnce(&'this mut f32) -> Result<&'this mut f32, Error_>
) -> Result<DocumentationExample, (Error_, Heads)>
pub(crate) fn try_new_or_recover<Error_>( int_data: i32, float_data: f32, int_reference_builder: impl for<'this> FnOnce(&'this i32) -> Result<&'this i32, Error_>, float_reference_builder: impl for<'this> FnOnce(&'this mut f32) -> Result<&'this mut f32, Error_> ) -> Result<DocumentationExample, (Error_, Heads)>
(See also DocumentationExampleTryBuilder::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 |
---|---|
int_data | Directly pass in the value this field should contain |
float_data | Directly pass in the value this field should contain |
int_reference_builder | Use a function or closure: (int_data: &_) -> Result<int_reference: _, Error_> |
float_reference_builder | Use a function or closure: (float_data: &mut _) -> Result<float_reference: _, Error_> |
sourcepub(crate) async fn try_new_async<Error_>(
int_data: i32,
float_data: f32,
int_reference_builder: impl for<'this> FnOnce(&'this i32) -> Pin<Box<dyn Future<Output = Result<&'this i32, Error_>> + 'this>>,
float_reference_builder: impl for<'this> FnOnce(&'this mut f32) -> Pin<Box<dyn Future<Output = Result<&'this mut f32, Error_>> + 'this>>
) -> Result<DocumentationExample, Error_>
pub(crate) async fn try_new_async<Error_>( int_data: i32, float_data: f32, int_reference_builder: impl for<'this> FnOnce(&'this i32) -> Pin<Box<dyn Future<Output = Result<&'this i32, Error_>> + 'this>>, float_reference_builder: impl for<'this> FnOnce(&'this mut f32) -> Pin<Box<dyn Future<Output = Result<&'this mut f32, Error_>> + 'this>> ) -> Result<DocumentationExample, Error_>
(See also DocumentationExampleAsyncTryBuilder::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 |
---|---|
int_data | Directly pass in the value this field should contain |
float_data | Directly pass in the value this field should contain |
int_reference_builder | Use a function or closure: (int_data: &_) -> Result<int_reference: _, Error_> |
float_reference_builder | Use a function or closure: (float_data: &mut _) -> Result<float_reference: _, Error_> |
sourcepub(crate) async fn try_new_or_recover_async<Error_>(
int_data: i32,
float_data: f32,
int_reference_builder: impl for<'this> FnOnce(&'this i32) -> Pin<Box<dyn Future<Output = Result<&'this i32, Error_>> + 'this>>,
float_reference_builder: impl for<'this> FnOnce(&'this mut f32) -> Pin<Box<dyn Future<Output = Result<&'this mut f32, Error_>> + 'this>>
) -> Result<DocumentationExample, (Error_, Heads)>
pub(crate) async fn try_new_or_recover_async<Error_>( int_data: i32, float_data: f32, int_reference_builder: impl for<'this> FnOnce(&'this i32) -> Pin<Box<dyn Future<Output = Result<&'this i32, Error_>> + 'this>>, float_reference_builder: impl for<'this> FnOnce(&'this mut f32) -> Pin<Box<dyn Future<Output = Result<&'this mut f32, Error_>> + 'this>> ) -> Result<DocumentationExample, (Error_, Heads)>
(See also DocumentationExampleAsyncTryBuilder::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 |
---|---|
int_data | Directly pass in the value this field should contain |
float_data | Directly pass in the value this field should contain |
int_reference_builder | Use a function or closure: (int_data: &_) -> Result<int_reference: _, Error_> |
float_reference_builder | Use a function or closure: (float_data: &mut _) -> Result<float_reference: _, Error_> |
sourcepub(crate) async fn try_new_async_send<Error_>(
int_data: i32,
float_data: f32,
int_reference_builder: impl for<'this> FnOnce(&'this i32) -> Pin<Box<dyn Future<Output = Result<&'this i32, Error_>> + Send + 'this>>,
float_reference_builder: impl for<'this> FnOnce(&'this mut f32) -> Pin<Box<dyn Future<Output = Result<&'this mut f32, Error_>> + Send + 'this>>
) -> Result<DocumentationExample, Error_>
pub(crate) async fn try_new_async_send<Error_>( int_data: i32, float_data: f32, int_reference_builder: impl for<'this> FnOnce(&'this i32) -> Pin<Box<dyn Future<Output = Result<&'this i32, Error_>> + Send + 'this>>, float_reference_builder: impl for<'this> FnOnce(&'this mut f32) -> Pin<Box<dyn Future<Output = Result<&'this mut f32, Error_>> + Send + 'this>> ) -> Result<DocumentationExample, Error_>
(See also DocumentationExampleAsyncSendTryBuilder::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 |
---|---|
int_data | Directly pass in the value this field should contain |
float_data | Directly pass in the value this field should contain |
int_reference_builder | Use a function or closure: (int_data: &_) -> Result<int_reference: _, Error_> |
float_reference_builder | Use a function or closure: (float_data: &mut _) -> Result<float_reference: _, Error_> |
sourcepub(crate) async fn try_new_or_recover_async_send<Error_>(
int_data: i32,
float_data: f32,
int_reference_builder: impl for<'this> FnOnce(&'this i32) -> Pin<Box<dyn Future<Output = Result<&'this i32, Error_>> + Send + 'this>>,
float_reference_builder: impl for<'this> FnOnce(&'this mut f32) -> Pin<Box<dyn Future<Output = Result<&'this mut f32, Error_>> + Send + 'this>>
) -> Result<DocumentationExample, (Error_, Heads)>
pub(crate) async fn try_new_or_recover_async_send<Error_>( int_data: i32, float_data: f32, int_reference_builder: impl for<'this> FnOnce(&'this i32) -> Pin<Box<dyn Future<Output = Result<&'this i32, Error_>> + Send + 'this>>, float_reference_builder: impl for<'this> FnOnce(&'this mut f32) -> Pin<Box<dyn Future<Output = Result<&'this mut f32, Error_>> + Send + 'this>> ) -> Result<DocumentationExample, (Error_, Heads)>
(See also DocumentationExampleAsyncSendTryBuilder::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 |
---|---|
int_data | Directly pass in the value this field should contain |
float_data | Directly pass in the value this field should contain |
int_reference_builder | Use a function or closure: (int_data: &_) -> Result<int_reference: _, Error_> |
float_reference_builder | Use a function or closure: (float_data: &mut _) -> Result<float_reference: _, Error_> |
sourcepub(crate) fn with_int_data<'outer_borrow, ReturnType>(
&'outer_borrow self,
user: impl for<'this> FnOnce(&'outer_borrow i32) -> ReturnType
) -> ReturnType
pub(crate) fn with_int_data<'outer_borrow, ReturnType>( &'outer_borrow self, user: impl for<'this> FnOnce(&'outer_borrow i32) -> ReturnType ) -> ReturnType
Provides limited immutable access to int_data
. This method was generated because the contents of int_data
are immutably borrowed by other fields.
sourcepub(crate) fn borrow_int_data<'this>(&'this self) -> &'this i32
pub(crate) fn borrow_int_data<'this>(&'this self) -> &'this i32
Provides limited immutable access to int_data
. This method was generated because the contents of int_data
are immutably borrowed by other fields.
sourcepub(crate) fn with_int_reference<'outer_borrow, ReturnType>(
&'outer_borrow self,
user: impl for<'this> FnOnce(&'outer_borrow &'this i32) -> ReturnType
) -> ReturnType
pub(crate) fn with_int_reference<'outer_borrow, ReturnType>( &'outer_borrow self, user: impl for<'this> FnOnce(&'outer_borrow &'this i32) -> ReturnType ) -> ReturnType
Provides an immutable reference to int_reference
. This method was generated because int_reference
is a tail field.
sourcepub(crate) fn borrow_int_reference<'this>(&'this self) -> &'this &'this i32
pub(crate) fn borrow_int_reference<'this>(&'this self) -> &'this &'this i32
Provides an immutable reference to int_reference
. This method was generated because int_reference
is a tail field.
sourcepub(crate) fn with_int_reference_mut<'outer_borrow, ReturnType>(
&'outer_borrow mut self,
user: impl for<'this> FnOnce(&'outer_borrow mut &'this i32) -> ReturnType
) -> ReturnType
pub(crate) fn with_int_reference_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 int_reference
. This method was generated because int_reference
is a tail field. No borrow_int_reference_mut
function was generated because Rust’s borrow checker is currently unable to guarantee that such a method would be used safely.
sourcepub(crate) fn with_float_reference<'outer_borrow, ReturnType>(
&'outer_borrow self,
user: impl for<'this> FnOnce(&'outer_borrow &'this mut f32) -> ReturnType
) -> ReturnType
pub(crate) fn with_float_reference<'outer_borrow, ReturnType>( &'outer_borrow self, user: impl for<'this> FnOnce(&'outer_borrow &'this mut f32) -> ReturnType ) -> ReturnType
Provides an immutable reference to float_reference
. This method was generated because float_reference
is a tail field.
sourcepub(crate) fn borrow_float_reference<'this>(
&'this self
) -> &'this &'this mut f32
pub(crate) fn borrow_float_reference<'this>( &'this self ) -> &'this &'this mut f32
Provides an immutable reference to float_reference
. This method was generated because float_reference
is a tail field.
sourcepub(crate) fn with_float_reference_mut<'outer_borrow, ReturnType>(
&'outer_borrow mut self,
user: impl for<'this> FnOnce(&'outer_borrow mut &'this mut f32) -> ReturnType
) -> ReturnType
pub(crate) fn with_float_reference_mut<'outer_borrow, ReturnType>( &'outer_borrow mut self, user: impl for<'this> FnOnce(&'outer_borrow mut &'this mut f32) -> ReturnType ) -> ReturnType
Provides a mutable reference to float_reference
. This method was generated because float_reference
is a tail field. No borrow_float_reference_mut
function was generated because Rust’s borrow checker is currently unable to guarantee that such a method would be used safely.
sourcepub(crate) fn with<'outer_borrow, ReturnType>(
&'outer_borrow self,
user: impl for<'this> FnOnce(BorrowedFields<'outer_borrow, 'this>) -> ReturnType
) -> ReturnType
pub(crate) 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.
sourcepub(crate) fn with_mut<'outer_borrow, ReturnType>(
&'outer_borrow mut self,
user: impl for<'this0, 'this1, 'this2> FnOnce(BorrowedMutFields<'outer_borrow, 'this2, 'this1, 'this0>) -> ReturnType
) -> ReturnType
pub(crate) fn with_mut<'outer_borrow, ReturnType>( &'outer_borrow mut self, user: impl for<'this0, 'this1, 'this2> FnOnce(BorrowedMutFields<'outer_borrow, 'this2, 'this1, 'this0>) -> ReturnType ) -> ReturnType
This method provides mutable references to all tail fields.
sourcepub(crate) fn into_heads(self) -> Heads
pub(crate) fn into_heads(self) -> Heads
This function drops all internally referencing fields and returns only the head fields of this struct.