#[non_exhaustive]pub struct BytesDeserializer;Expand description
Deserializes byte arrays into refcounted [bytes::Bytes].
This is the zero-copy counterpart to
ByteArrayDeserializer:
where the latter must copy the borrowed &[u8] into an owned Vec<u8>,
BytesDeserializer slices the owning fetch buffer
(deserialize_from_shared) so the
returned Bytes shares the single buffer that owns the whole fetch payload
(consumer-threading.md §27). No per-record key/value copy occurs on the
receive path.
The plain deserialize entry point (used when
no shared source is available, e.g. unit tests) still copies via
[Bytes::copy_from_slice], matching the §27 “safe copy fallback” contract.
Implementations§
Trait Implementations§
Source§impl Clone for BytesDeserializer
impl Clone for BytesDeserializer
Source§fn clone(&self) -> BytesDeserializer
fn clone(&self) -> BytesDeserializer
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BytesDeserializer
impl Debug for BytesDeserializer
Source§impl Default for BytesDeserializer
impl Default for BytesDeserializer
Source§fn default() -> BytesDeserializer
fn default() -> BytesDeserializer
Returns the “default value” for a type. Read more
Source§impl Deserializer<Bytes> for BytesDeserializer
impl Deserializer<Bytes> for BytesDeserializer
Source§fn deserialize(&self, _topic: &str, data: &[u8]) -> Result<Bytes, Error>
fn deserialize(&self, _topic: &str, data: &[u8]) -> Result<Bytes, Error>
Deserialize a record value from a byte slice. Read more
Deserialize from a byte slice that is a subslice of a refcounted source
buffer, enabling zero-copy
T for byte-typed deserializers. Read moreHeader-aware variant of
deserialize_from_shared. Read moreSource§fn deserialize_headers(
&self,
topic: &str,
_headers: &dyn Headers,
data: &[u8],
) -> Result<T, Error>
fn deserialize_headers( &self, topic: &str, _headers: &dyn Headers, data: &[u8], ) -> Result<T, Error>
Deserialize a record value with access to its headers. Read more
Auto Trait Implementations§
impl Freeze for BytesDeserializer
impl RefUnwindSafe for BytesDeserializer
impl Send for BytesDeserializer
impl Sync for BytesDeserializer
impl Unpin for BytesDeserializer
impl UnsafeUnpin for BytesDeserializer
impl UnwindSafe for BytesDeserializer
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