Struct Codec
pub struct Codec<Req, Resp> { /* private fields */ }
Available on crate features
request-response
and json
only.Implementations§
§impl<Req, Resp> Codec<Req, Resp>
impl<Req, Resp> Codec<Req, Resp>
pub fn set_request_size_maximum(
self,
request_size_maximum: u64,
) -> Codec<Req, Resp>
pub fn set_request_size_maximum( self, request_size_maximum: u64, ) -> Codec<Req, Resp>
Sets the limit for request size in bytes.
pub fn set_response_size_maximum(
self,
response_size_maximum: u64,
) -> Codec<Req, Resp>
pub fn set_response_size_maximum( self, response_size_maximum: u64, ) -> Codec<Req, Resp>
Sets the limit for response size in bytes.
Trait Implementations§
§impl<Req, Resp> Codec for Codec<Req, Resp>
impl<Req, Resp> Codec for Codec<Req, Resp>
§type Protocol = StreamProtocol
type Protocol = StreamProtocol
The type of protocol(s) or protocol versions being negotiated.
§fn read_request<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 mut self,
_: &'life1 <Codec<Req, Resp> as Codec>::Protocol,
io: &'life2 mut T,
) -> Pin<Box<dyn Future<Output = Result<Req, Error>> + Send + 'async_trait>>
fn read_request<'life0, 'life1, 'life2, 'async_trait, T>( &'life0 mut self, _: &'life1 <Codec<Req, Resp> as Codec>::Protocol, io: &'life2 mut T, ) -> Pin<Box<dyn Future<Output = Result<Req, Error>> + Send + 'async_trait>>
Reads a request from the given I/O stream according to the
negotiated protocol.
§fn read_response<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 mut self,
_: &'life1 <Codec<Req, Resp> as Codec>::Protocol,
io: &'life2 mut T,
) -> Pin<Box<dyn Future<Output = Result<Resp, Error>> + Send + 'async_trait>>
fn read_response<'life0, 'life1, 'life2, 'async_trait, T>( &'life0 mut self, _: &'life1 <Codec<Req, Resp> as Codec>::Protocol, io: &'life2 mut T, ) -> Pin<Box<dyn Future<Output = Result<Resp, Error>> + Send + 'async_trait>>
Reads a response from the given I/O stream according to the
negotiated protocol.
§fn write_request<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 mut self,
_: &'life1 <Codec<Req, Resp> as Codec>::Protocol,
io: &'life2 mut T,
req: <Codec<Req, Resp> as Codec>::Request,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
fn write_request<'life0, 'life1, 'life2, 'async_trait, T>( &'life0 mut self, _: &'life1 <Codec<Req, Resp> as Codec>::Protocol, io: &'life2 mut T, req: <Codec<Req, Resp> as Codec>::Request, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
Writes a request to the given I/O stream according to the
negotiated protocol.
§fn write_response<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 mut self,
_: &'life1 <Codec<Req, Resp> as Codec>::Protocol,
io: &'life2 mut T,
resp: <Codec<Req, Resp> as Codec>::Response,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
fn write_response<'life0, 'life1, 'life2, 'async_trait, T>( &'life0 mut self, _: &'life1 <Codec<Req, Resp> as Codec>::Protocol, io: &'life2 mut T, resp: <Codec<Req, Resp> as Codec>::Response, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
Writes a response to the given I/O stream according to the
negotiated protocol.
Auto Trait Implementations§
impl<Req, Resp> Freeze for Codec<Req, Resp>
impl<Req, Resp> RefUnwindSafe for Codec<Req, Resp>where
Req: RefUnwindSafe,
Resp: RefUnwindSafe,
impl<Req, Resp> Send for Codec<Req, Resp>
impl<Req, Resp> Sync for Codec<Req, Resp>
impl<Req, Resp> Unpin for Codec<Req, Resp>
impl<Req, Resp> UnwindSafe for Codec<Req, Resp>where
Req: UnwindSafe,
Resp: UnwindSafe,
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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