pub struct RespCodec { /* private fields */ }Expand description
Tokio-util codec for RESP2/RESP3 framing.
A single instance manages one connection’s protocol state. Call
set_version after a successful HELLO 3 handshake to switch to RESP3.
Implementations§
Source§impl RespCodec
impl RespCodec
pub fn new(version: Version) -> Self
pub fn resp2() -> Self
pub fn resp3() -> Self
pub fn with_max_frame_bytes(self, limit: usize) -> Self
Sourcepub fn set_version(&mut self, version: Version)
pub fn set_version(&mut self, version: Version)
Switch protocol version mid-stream (e.g. after HELLO 3 succeeds).
pub fn version(&self) -> Version
Trait Implementations§
Source§impl Decoder for RespCodec
impl Decoder for RespCodec
Source§fn decode(&mut self, src: &mut BytesMut) -> Result<Option<Value>, RespError>
fn decode(&mut self, src: &mut BytesMut) -> Result<Option<Value>, RespError>
Attempts to decode a frame from the provided buffer of bytes. Read more
Auto Trait Implementations§
impl Freeze for RespCodec
impl RefUnwindSafe for RespCodec
impl Send for RespCodec
impl Sync for RespCodec
impl Unpin for RespCodec
impl UnsafeUnpin for RespCodec
impl UnwindSafe for RespCodec
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