Skip to main content
pub struct ByteBuf  /* private fields */ 

Re-exported because generated request/response types expose Avro bytes fields as ByteBuf; callers would otherwise need their own serde_bytes dependency pinned to a matching version. Wrapper around Vec<u8> to serialize and deserialize efficiently.

Implementations

Source

pub fn new() -> ByteBuf

Construct a new, empty ByteBuf.

Construct a new, empty ByteBuf with the specified capacity.

Source

pub fn from<T>(bytes: T) ->ByteBuf
where T: Into<Vec<u8>>,

Wrap existing bytes in a ByteBuf.

Source

pub fn into_vec(self) -> Vec<u8>

Unwrap the vector of byte underlying this ByteBuf.

Trait Implementations

Source

impl AsMut<[u8]> for ByteBuf

Source

fn as_mut(&mut self) -> &mut [u8]

Converts this type into a mutable reference of the (usually inferred) input type.
Source

impl AsRef<[u8]> for ByteBuf

Source

fn as_ref(&self) -> &[u8]

Converts this type into a shared reference of the (usually inferred) input type.
Source

fn borrow(&self) -> &Bytes

Immutably borrows from an owned value. Read more
Source

fn borrow_mut(&mut self) -> &mut Bytes

Mutably borrows from an owned value. Read more
Source

fn clone(&self) -> ByteBuf

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source

fn fmt(&self, f: &mut Formatter<’_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
The resulting type after dereferencing.
Source

fn deref(&self) -> &<ByteBuf as Deref>::Target

Dereferences the value.
Source

fn deref_mut(&mut self) -> &mut <ByteBuf as Deref>::Target

Mutably dereferences the value.
Source

impl<‘de> Deserialize<‘de> for ByteBuf

Source

fn deserialize<D>( deserializer: D, ) ->Result<ByteBuf, <D as Deserializer<‘de>>::Error>
where D: Deserializer<‘de>,

Deserialize this value from the given Serde deserializer. Read more
Source

impl<‘de> Deserialize<‘de> for ByteBuf

Available on crate features alloc or std only.
Source

fn deserialize<D>( deserializer: D, ) ->Result<ByteBuf, <D as Deserializer<‘de>>::Error>
where D: Deserializer<‘de>,

Source

impl Eq for ByteBuf

Source

fn from(bytes: Vec<u8>) -> ByteBuf

Converts to this type from the input type.
Source

fn hash<H>(&self, state: &mut H)
where H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source

type Item = u8

The type of the elements being iterated over.
Which kind of iterator are we turning this into?
Creates an iterator from a value. Read more
Source

impl<‘a> IntoIterator for &‘a ByteBuf

Source

type Item = &‘a u8

The type of the elements being iterated over.
Source

type IntoIter = <&‘a [u8] as IntoIterator>::IntoIter

Which kind of iterator are we turning this into?
Creates an iterator from a value. Read more
Source

impl<‘a> IntoIterator for &‘a mut ByteBuf

Source

type Item = &‘a mut u8

The type of the elements being iterated over.
Source

type IntoIter = <&‘a mut [u8] as IntoIterator>::IntoIter

Which kind of iterator are we turning this into?
Source

fn into_iter(self) -> <&‘a mut ByteBuf as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
Source

fn cmp(&self, other: &ByteBuf) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source

impl<Rhs>PartialEq<Rhs> for ByteBuf
where Rhs: AsRef<[u8]> + ?Sized,

Source

fn eq(&self, other: &Rhs) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source

impl<Rhs>PartialOrd<Rhs> for ByteBuf
where Rhs: AsRef<[u8]> + ?Sized,

Source

fn partial_cmp(&self, other: &Rhs) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source

fn serialize<S>( &self, serializer: S, ) ->Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source

impl Serialize for ByteBuf

Available on crate features alloc or std only.
Source

fn serialize<S>( &self, serializer: S, ) ->Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer,