pub struct Codec<T, B> {
inner: FramedRead<FramedWrite<T, B>>,
}
Fields§
§inner: FramedRead<FramedWrite<T, B>>
Implementations§
Source§impl<T, B> Codec<T, B>
impl<T, B> Codec<T, B>
Sourcepub fn with_max_recv_frame_size(io: T, max_frame_size: usize) -> Self
pub fn with_max_recv_frame_size(io: T, max_frame_size: usize) -> Self
Returns a new Codec
with the given maximum frame size
Source§impl<T, B> Codec<T, B>
impl<T, B> Codec<T, B>
Sourcepub fn set_max_recv_frame_size(&mut self, val: usize)
pub fn set_max_recv_frame_size(&mut self, val: usize)
Updates the max received frame size.
The change takes effect the next time a frame is decoded. In other
words, if a frame is currently in process of being decoded with a frame
size greater than val
but less than the max frame size in effect
before calling this function, then the frame will be allowed.
Sourcepub fn max_send_frame_size(&self) -> usize
pub fn max_send_frame_size(&self) -> usize
Returns the max frame size that can be sent to the peer.
Sourcepub fn set_max_send_frame_size(&mut self, val: usize)
pub fn set_max_send_frame_size(&mut self, val: usize)
Set the peer’s max frame size.
Sourcepub fn set_send_header_table_size(&mut self, val: usize)
pub fn set_send_header_table_size(&mut self, val: usize)
Set the peer’s header table size size.
Sourcepub fn set_recv_header_table_size(&mut self, val: usize)
pub fn set_recv_header_table_size(&mut self, val: usize)
Set the decoder header table size size.
Sourcepub fn set_max_recv_header_list_size(&mut self, val: usize)
pub fn set_max_recv_header_list_size(&mut self, val: usize)
Set the max header list size that can be received.
Sourcepub(crate) fn take_last_data_frame(&mut self) -> Option<Data<B>>
pub(crate) fn take_last_data_frame(&mut self) -> Option<Data<B>>
Takes the data payload value that was fully written to the socket
fn framed_write(&mut self) -> &mut FramedWrite<T, B>
Source§impl<T, B> Codec<T, B>
impl<T, B> Codec<T, B>
Sourcepub fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<()>>
pub fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<()>>
Returns Ready
when the codec can buffer a frame
Sourcepub fn buffer(&mut self, item: Frame<B>) -> Result<(), UserError>
pub fn buffer(&mut self, item: Frame<B>) -> Result<(), UserError>
Buffer a frame.
poll_ready
must be called first to ensure that a frame may be
accepted.
TODO: Rename this to avoid conflicts with Sink::buffer
Trait Implementations§
Source§impl<T, B> Sink<Frame<B>> for Codec<T, B>
impl<T, B> Sink<Frame<B>> for Codec<T, B>
Source§fn poll_ready(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<(), Self::Error>>
fn poll_ready( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>
Returns Ready
when the codec can buffer a frame
Source§fn poll_flush(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<(), Self::Error>>
fn poll_flush( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>
Flush buffered data to the wire