pub struct RawCodec;Expand description
Raw codec that passes bytes through without transformation.
This is the simplest codec - it does not perform any serialization. Use this when you have raw binary data that should be sent as-is.
Implementations§
Source§impl RawCodec
impl RawCodec
Sourcepub fn serialize(data: &[u8]) -> Bytes
pub fn serialize(data: &[u8]) -> Bytes
Serialize raw bytes (copies data into Bytes).
For truly zero-copy, use serialize_bytes with an existing Bytes value.
Sourcepub fn serialize_bytes(data: Bytes) -> Bytes
pub fn serialize_bytes(data: Bytes) -> Bytes
Serialize Bytes (true zero-copy, just returns the input).
Sourcepub fn deserialize(data: &[u8]) -> &[u8] ⓘ
pub fn deserialize(data: &[u8]) -> &[u8] ⓘ
Deserialize - returns a reference to the input (zero-copy).
Sourcepub fn deserialize_bytes(data: &Bytes) -> &[u8] ⓘ
pub fn deserialize_bytes(data: &Bytes) -> &[u8] ⓘ
Deserialize Bytes - returns a reference to the data (zero-copy).
Auto Trait Implementations§
impl Freeze for RawCodec
impl RefUnwindSafe for RawCodec
impl Send for RawCodec
impl Sync for RawCodec
impl Unpin for RawCodec
impl UnwindSafe for RawCodec
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