#[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 returns the record’s key/value as the consumer hands it
to deserialize_with_headers_bytes:
a refcounted slice of the buffer that owns the record’s bytes
(consumer-threading.md §27) — the fetched records buffer for an uncompressed
batch, the buffer the record was decompressed into for a compressed one. No
per-record key/value copy occurs on the receive path.
The plain deserialize entry point (used when
no shared buffer 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§async fn deserialize(&self, _topic: &str, data: &[u8]) -> Result<Bytes, Error>
async fn deserialize(&self, _topic: &str, data: &[u8]) -> Result<Bytes, Error>
Deserialize a record value from a byte array into a value or object. Read more
Source§async fn deserialize_with_headers_bytes(
&self,
_topic: &str,
_headers: &mut RecordHeaders,
data: &Bytes,
) -> Result<Bytes, Error>
async fn deserialize_with_headers_bytes( &self, _topic: &str, _headers: &mut RecordHeaders, data: &Bytes, ) -> Result<Bytes, Error>
Deserialize a record value from a [
Bytes] buffer into a value or object. Read moreSource§fn deserialize_with_headers<'a>(
&'a self,
topic: &'a str,
headers: &'a mut RecordHeaders,
data: &'a [u8],
) -> impl Future<Output = Result<T, Error>> + Send + 'a
fn deserialize_with_headers<'a>( &'a self, topic: &'a str, headers: &'a mut RecordHeaders, data: &'a [u8], ) -> impl Future<Output = Result<T, Error>> + Send + 'a
Deserialize a record value from a byte array into a value or object. 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