pub struct MailboxCodec;Expand description
The codec for the mailbox protocol.
This codec is used by the libp2p request_response behaviour to encode
and decode mailbox requests and responses.
Implementations§
Trait Implementations§
Source§impl Clone for MailboxCodec
impl Clone for MailboxCodec
Source§fn clone(&self) -> MailboxCodec
fn clone(&self) -> MailboxCodec
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Codec for MailboxCodec
impl Codec for MailboxCodec
Source§fn read_request<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 mut self,
_: &'life1 Self::Protocol,
io: &'life2 mut T,
) -> Pin<Box<dyn Future<Output = Result<Self::Request>> + Send + 'async_trait>>
fn read_request<'life0, 'life1, 'life2, 'async_trait, T>( &'life0 mut self, _: &'life1 Self::Protocol, io: &'life2 mut T, ) -> Pin<Box<dyn Future<Output = Result<Self::Request>> + Send + 'async_trait>>
Reads a length-prefixed JSON-encoded request from the given I/O stream.
Source§fn read_response<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 mut self,
_: &'life1 Self::Protocol,
io: &'life2 mut T,
) -> Pin<Box<dyn Future<Output = Result<Self::Response>> + Send + 'async_trait>>
fn read_response<'life0, 'life1, 'life2, 'async_trait, T>( &'life0 mut self, _: &'life1 Self::Protocol, io: &'life2 mut T, ) -> Pin<Box<dyn Future<Output = Result<Self::Response>> + Send + 'async_trait>>
Reads a length-prefixed JSON-encoded response from the given I/O stream.
Source§fn write_request<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 mut self,
_: &'life1 Self::Protocol,
io: &'life2 mut T,
req: Self::Request,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
T: AsyncWrite + Unpin + Send + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn write_request<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 mut self,
_: &'life1 Self::Protocol,
io: &'life2 mut T,
req: Self::Request,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
T: AsyncWrite + Unpin + Send + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Writes a length-prefixed JSON-encoded request to the given I/O stream.
Source§fn write_response<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 mut self,
_: &'life1 Self::Protocol,
io: &'life2 mut T,
res: Self::Response,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
T: AsyncWrite + Unpin + Send + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn write_response<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 mut self,
_: &'life1 Self::Protocol,
io: &'life2 mut T,
res: Self::Response,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
T: AsyncWrite + Unpin + Send + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Writes a length-prefixed JSON-encoded response to the given I/O stream.
Source§type Request = MailboxRequest
type Request = MailboxRequest
The type of inbound and outbound requests.
Source§type Response = MailboxResponse
type Response = MailboxResponse
The type of inbound and outbound responses.
Source§impl Default for MailboxCodec
impl Default for MailboxCodec
Source§fn default() -> MailboxCodec
fn default() -> MailboxCodec
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for MailboxCodec
impl RefUnwindSafe for MailboxCodec
impl Send for MailboxCodec
impl Sync for MailboxCodec
impl Unpin for MailboxCodec
impl UnwindSafe for MailboxCodec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more