#[non_exhaustive]pub struct ByteArrayDeserializer;Expand description
Deserializes byte arrays by returning the bytes unchanged.
Corresponds to Java’s
org.apache.kafka.common.serialization.ByteArrayDeserializer, whose
deserialize returns the input byte[] as-is.
In Java the input array is returned by reference (no copy). In Rust the
Deserializer trait hands deserialize a &[u8] borrowed from the
CompletedFetch buffer (consumer-threading.md §27), so the only way to
return the owned Vec<u8> the API promises is to copy via
slice::to_vec. That single allocation is the user-deserializer’s
budget per §27 and is unavoidable for an owned-Vec<u8> value type.
Implementations§
Trait Implementations§
Source§impl Clone for ByteArrayDeserializer
impl Clone for ByteArrayDeserializer
Source§fn clone(&self) -> ByteArrayDeserializer
fn clone(&self) -> ByteArrayDeserializer
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 ByteArrayDeserializer
impl Debug for ByteArrayDeserializer
Source§impl Default for ByteArrayDeserializer
impl Default for ByteArrayDeserializer
Source§fn default() -> ByteArrayDeserializer
fn default() -> ByteArrayDeserializer
Returns the “default value” for a type. Read more
Source§impl Deserializer<Vec<u8>> for ByteArrayDeserializer
impl Deserializer<Vec<u8>> for ByteArrayDeserializer
Source§fn deserialize(&self, _topic: &str, data: &[u8]) -> Result<Vec<u8>, Error>
fn deserialize(&self, _topic: &str, data: &[u8]) -> Result<Vec<u8>, Error>
Deserialize a record value from a byte slice. Read more
Source§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
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 moreAuto Trait Implementations§
impl Freeze for ByteArrayDeserializer
impl RefUnwindSafe for ByteArrayDeserializer
impl Send for ByteArrayDeserializer
impl Sync for ByteArrayDeserializer
impl Unpin for ByteArrayDeserializer
impl UnsafeUnpin for ByteArrayDeserializer
impl UnwindSafe for ByteArrayDeserializer
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