ProtocolMessageGuard

Struct ProtocolMessageGuard 

Source
pub struct ProtocolMessageGuard { /* private fields */ }
Expand description

The self-referencing struct.

Implementations§

Source§

impl ProtocolMessageGuard

Source

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:

ArgumentSuggested Use
bufferDirectly pass in the value this field should contain
inner_builderUse a function or closure: (buffer: &_) -> inner: _
Source

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:

ArgumentSuggested Use
bufferDirectly pass in the value this field should contain
inner_builderUse a function or closure: (buffer: &_) -> inner: _
Source

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:

ArgumentSuggested Use
bufferDirectly pass in the value this field should contain
inner_builderUse a function or closure: (buffer: &_) -> inner: _
Source

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:

ArgumentSuggested Use
bufferDirectly pass in the value this field should contain
inner_builderUse a function or closure: (buffer: &_) -> Result<inner: _, Error_>
Source

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:

ArgumentSuggested Use
bufferDirectly pass in the value this field should contain
inner_builderUse a function or closure: (buffer: &_) -> Result<inner: _, Error_>
Source

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:

ArgumentSuggested Use
bufferDirectly pass in the value this field should contain
inner_builderUse a function or closure: (buffer: &_) -> Result<inner: _, Error_>
Source

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:

ArgumentSuggested Use
bufferDirectly pass in the value this field should contain
inner_builderUse a function or closure: (buffer: &_) -> Result<inner: _, Error_>
Source

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:

ArgumentSuggested Use
bufferDirectly pass in the value this field should contain
inner_builderUse a function or closure: (buffer: &_) -> Result<inner: _, Error_>
Source

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:

ArgumentSuggested Use
bufferDirectly pass in the value this field should contain
inner_builderUse a function or closure: (buffer: &_) -> Result<inner: _, Error_>
Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

Source

pub fn message(&self) -> &ProtocolMessage<'_>

The inner message of this guard.

Trait Implementations§

Source§

impl Drop for ProtocolMessageGuard

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more