pub struct ProtocolMessageGuard { /* private fields */ }Expand description
The self-referencing struct.
Implementations§
Source§impl ProtocolMessageGuard
impl ProtocolMessageGuard
Sourcepub fn new(
buffer: Bytes,
inner_builder: impl for<'this> FnOnce(&'this Bytes) -> ProtocolMessage<'this>,
) -> ProtocolMessageGuard
pub fn new( buffer: Bytes, inner_builder: impl for<'this> FnOnce(&'this Bytes) -> ProtocolMessage<'this>, ) -> ProtocolMessageGuard
Constructs a new instance of this self-referential struct. (See also ProtocolMessageGuardBuilder::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 |
|---|---|
buffer | Directly pass in the value this field should contain |
inner_builder | Use a function or closure: (buffer: &_) -> inner: _ |
Sourcepub async fn new_async(
buffer: Bytes,
inner_builder: impl for<'this> FnOnce(&'this Bytes) -> Pin<Box<dyn Future<Output = ProtocolMessage<'this>> + 'this>>,
) -> ProtocolMessageGuard
pub async fn new_async( buffer: Bytes, inner_builder: impl for<'this> FnOnce(&'this Bytes) -> Pin<Box<dyn Future<Output = ProtocolMessage<'this>> + 'this>>, ) -> ProtocolMessageGuard
Constructs a new instance of this self-referential struct. (See also ProtocolMessageGuardAsyncBuilder::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 |
|---|---|
buffer | Directly pass in the value this field should contain |
inner_builder | Use a function or closure: (buffer: &_) -> inner: _ |
Sourcepub async fn new_async_send(
buffer: Bytes,
inner_builder: impl for<'this> FnOnce(&'this Bytes) -> Pin<Box<dyn Future<Output = ProtocolMessage<'this>> + Send + 'this>>,
) -> ProtocolMessageGuard
pub async fn new_async_send( buffer: Bytes, inner_builder: impl for<'this> FnOnce(&'this Bytes) -> Pin<Box<dyn Future<Output = ProtocolMessage<'this>> + Send + 'this>>, ) -> ProtocolMessageGuard
Constructs a new instance of this self-referential struct. (See also ProtocolMessageGuardAsyncSendBuilder::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 |
|---|---|
buffer | Directly pass in the value this field should contain |
inner_builder | Use a function or closure: (buffer: &_) -> inner: _ |
Sourcepub fn try_new<Error_>(
buffer: Bytes,
inner_builder: impl for<'this> FnOnce(&'this Bytes) -> Result<ProtocolMessage<'this>, Error_>,
) -> Result<ProtocolMessageGuard, Error_>
pub fn try_new<Error_>( buffer: Bytes, inner_builder: impl for<'this> FnOnce(&'this Bytes) -> Result<ProtocolMessage<'this>, Error_>, ) -> Result<ProtocolMessageGuard, Error_>
(See also ProtocolMessageGuardTryBuilder::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 |
|---|---|
buffer | Directly pass in the value this field should contain |
inner_builder | Use a function or closure: (buffer: &_) -> Result<inner: _, Error_> |
Sourcepub fn try_new_or_recover<Error_>(
buffer: Bytes,
inner_builder: impl for<'this> FnOnce(&'this Bytes) -> Result<ProtocolMessage<'this>, Error_>,
) -> Result<ProtocolMessageGuard, (Error_, Heads)>
pub fn try_new_or_recover<Error_>( buffer: Bytes, inner_builder: impl for<'this> FnOnce(&'this Bytes) -> Result<ProtocolMessage<'this>, Error_>, ) -> Result<ProtocolMessageGuard, (Error_, Heads)>
(See also ProtocolMessageGuardTryBuilder::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 |
|---|---|
buffer | Directly pass in the value this field should contain |
inner_builder | Use a function or closure: (buffer: &_) -> Result<inner: _, Error_> |
Sourcepub async fn try_new_async<Error_>(
buffer: Bytes,
inner_builder: impl for<'this> FnOnce(&'this Bytes) -> Pin<Box<dyn Future<Output = Result<ProtocolMessage<'this>, Error_>> + 'this>>,
) -> Result<ProtocolMessageGuard, Error_>
pub async fn try_new_async<Error_>( buffer: Bytes, inner_builder: impl for<'this> FnOnce(&'this Bytes) -> Pin<Box<dyn Future<Output = Result<ProtocolMessage<'this>, Error_>> + 'this>>, ) -> Result<ProtocolMessageGuard, Error_>
(See also ProtocolMessageGuardAsyncTryBuilder::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 |
|---|---|
buffer | Directly pass in the value this field should contain |
inner_builder | Use a function or closure: (buffer: &_) -> Result<inner: _, Error_> |
Sourcepub async fn try_new_or_recover_async<Error_>(
buffer: Bytes,
inner_builder: impl for<'this> FnOnce(&'this Bytes) -> Pin<Box<dyn Future<Output = Result<ProtocolMessage<'this>, Error_>> + 'this>>,
) -> Result<ProtocolMessageGuard, (Error_, Heads)>
pub async fn try_new_or_recover_async<Error_>( buffer: Bytes, inner_builder: impl for<'this> FnOnce(&'this Bytes) -> Pin<Box<dyn Future<Output = Result<ProtocolMessage<'this>, Error_>> + 'this>>, ) -> Result<ProtocolMessageGuard, (Error_, Heads)>
(See also ProtocolMessageGuardAsyncTryBuilder::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 |
|---|---|
buffer | Directly pass in the value this field should contain |
inner_builder | Use a function or closure: (buffer: &_) -> Result<inner: _, Error_> |
Sourcepub async fn try_new_async_send<Error_>(
buffer: Bytes,
inner_builder: impl for<'this> FnOnce(&'this Bytes) -> Pin<Box<dyn Future<Output = Result<ProtocolMessage<'this>, Error_>> + Send + 'this>>,
) -> Result<ProtocolMessageGuard, Error_>
pub async fn try_new_async_send<Error_>( buffer: Bytes, inner_builder: impl for<'this> FnOnce(&'this Bytes) -> Pin<Box<dyn Future<Output = Result<ProtocolMessage<'this>, Error_>> + Send + 'this>>, ) -> Result<ProtocolMessageGuard, Error_>
(See also ProtocolMessageGuardAsyncSendTryBuilder::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 |
|---|---|
buffer | Directly pass in the value this field should contain |
inner_builder | Use a function or closure: (buffer: &_) -> Result<inner: _, Error_> |
Sourcepub async fn try_new_or_recover_async_send<Error_>(
buffer: Bytes,
inner_builder: impl for<'this> FnOnce(&'this Bytes) -> Pin<Box<dyn Future<Output = Result<ProtocolMessage<'this>, Error_>> + Send + 'this>>,
) -> Result<ProtocolMessageGuard, (Error_, Heads)>
pub async fn try_new_or_recover_async_send<Error_>( buffer: Bytes, inner_builder: impl for<'this> FnOnce(&'this Bytes) -> Pin<Box<dyn Future<Output = Result<ProtocolMessage<'this>, Error_>> + Send + 'this>>, ) -> Result<ProtocolMessageGuard, (Error_, Heads)>
(See also ProtocolMessageGuardAsyncSendTryBuilder::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 |
|---|---|
buffer | Directly pass in the value this field should contain |
inner_builder | Use a function or closure: (buffer: &_) -> Result<inner: _, Error_> |
Sourcepub fn with_buffer<'outer_borrow, ReturnType>(
&'outer_borrow self,
user: impl for<'this> FnOnce(&'outer_borrow Bytes) -> ReturnType,
) -> ReturnType
pub fn with_buffer<'outer_borrow, ReturnType>( &'outer_borrow self, user: impl for<'this> FnOnce(&'outer_borrow Bytes) -> ReturnType, ) -> ReturnType
Provides limited immutable access to buffer. This method was generated because the contents of buffer are immutably borrowed by other fields.
Sourcepub fn borrow_buffer<'this>(&'this self) -> &'this Bytes
pub fn borrow_buffer<'this>(&'this self) -> &'this Bytes
Provides limited immutable access to buffer. This method was generated because the contents of buffer are immutably borrowed by other fields.
Sourcepub fn with_inner<'outer_borrow, ReturnType>(
&'outer_borrow self,
user: impl for<'this> FnOnce(&'outer_borrow ProtocolMessage<'this>) -> ReturnType,
) -> ReturnType
pub fn with_inner<'outer_borrow, ReturnType>( &'outer_borrow self, user: impl for<'this> FnOnce(&'outer_borrow ProtocolMessage<'this>) -> ReturnType, ) -> ReturnType
Provides an immutable reference to inner. This method was generated because inner is a tail field.
Sourcepub fn borrow_inner<'this>(&'this self) -> &'this ProtocolMessage<'this>
pub fn borrow_inner<'this>(&'this self) -> &'this ProtocolMessage<'this>
Provides an immutable reference to inner. This method was generated because inner is a tail field.
Sourcepub fn with_inner_mut<'outer_borrow, ReturnType>(
&'outer_borrow mut self,
user: impl for<'this> FnOnce(&'outer_borrow mut ProtocolMessage<'this>) -> ReturnType,
) -> ReturnType
pub fn with_inner_mut<'outer_borrow, ReturnType>( &'outer_borrow mut self, user: impl for<'this> FnOnce(&'outer_borrow mut ProtocolMessage<'this>) -> ReturnType, ) -> ReturnType
Provides a mutable reference to inner. This method was generated because inner is a tail field. No borrow_inner_mut function was generated because Rust’s borrow checker is currently unable to guarantee that such a method would be used safely.
Sourcepub 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.
Sourcepub fn with_mut<'outer_borrow, ReturnType>(
&'outer_borrow mut self,
user: impl for<'this0, 'this1> FnOnce(BorrowedMutFields<'outer_borrow, 'this1, 'this0>) -> ReturnType,
) -> ReturnType
pub fn with_mut<'outer_borrow, ReturnType>( &'outer_borrow mut self, user: impl for<'this0, 'this1> FnOnce(BorrowedMutFields<'outer_borrow, 'this1, 'this0>) -> ReturnType, ) -> ReturnType
This method provides mutable references to all tail fields.
Sourcepub fn into_heads(self) -> Heads
pub fn into_heads(self) -> Heads
This function drops all internally referencing fields and returns only the head fields of this struct.
Source§impl ProtocolMessageGuard
impl ProtocolMessageGuard
Sourcepub fn message(&self) -> &ProtocolMessage<'_>
pub fn message(&self) -> &ProtocolMessage<'_>
The inner message of this guard.