pub struct BytesCodec;Expand description
A no-op codec for payloads that are already byte buffers.
Encoding clones the buffer and decoding copies the input, so values pass through unchanged. This is the “raw framing” option for payloads that carry their own format, such as an image chunk or a pre-encoded frame.
§Examples
use pamoja_codec::{BytesCodec, Codec};
let codec = BytesCodec;
let payload = vec![0xde, 0xad, 0xbe, 0xef];
let encoded = codec.encode(&payload).unwrap();
assert_eq!(codec.decode(&encoded).unwrap(), payload);Trait Implementations§
Source§impl Clone for BytesCodec
impl Clone for BytesCodec
Source§fn clone(&self) -> BytesCodec
fn clone(&self) -> BytesCodec
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for BytesCodec
Source§impl Debug for BytesCodec
impl Debug for BytesCodec
Source§impl Default for BytesCodec
impl Default for BytesCodec
Source§fn default() -> BytesCodec
fn default() -> BytesCodec
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for BytesCodec
impl RefUnwindSafe for BytesCodec
impl Send for BytesCodec
impl Sync for BytesCodec
impl Unpin for BytesCodec
impl UnsafeUnpin for BytesCodec
impl UnwindSafe for BytesCodec
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