pub struct Encoder;Expand description
Encodes requests and responses into frames.
Implementations§
Source§impl Encoder
impl Encoder
Sourcepub fn encode_request(request: &Request) -> Result<BytesMut, ProtocolError>
pub fn encode_request(request: &Request) -> Result<BytesMut, ProtocolError>
Encodes a request into a frame.
Sourcepub fn encode_response(response: &Response) -> Result<BytesMut, ProtocolError>
pub fn encode_response(response: &Response) -> Result<BytesMut, ProtocolError>
Encodes a response into a frame.
Sourcepub fn encode_json<T: Serialize>(value: &T) -> Result<BytesMut, ProtocolError>
pub fn encode_json<T: Serialize>(value: &T) -> Result<BytesMut, ProtocolError>
Encodes any JSON-serializable value into a frame.
Auto Trait Implementations§
impl Freeze for Encoder
impl RefUnwindSafe for Encoder
impl Send for Encoder
impl Sync for Encoder
impl Unpin for Encoder
impl UnsafeUnpin for Encoder
impl UnwindSafe for Encoder
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