Skip to main content

MultiEncoded

Struct MultiEncoded 

Source
pub struct MultiEncoded(/* private fields */);
Expand description

A multicodec-encoded byte slice (borrowed)

Implementations§

Source§

impl MultiEncoded

Source

pub fn new(bytes: &[u8]) -> Result<&Self, EncodingError>

Create a new multiencoded byte slice Validates the codec encoding

Source

pub fn len(&self) -> usize

Size of the byte array (including codec prefix)

Source

pub fn is_empty(&self) -> bool

Returns true if empty

Source

pub fn parts(&self) -> (u64, &[u8])

Separates the codec and the data

Source

pub fn codec(&self) -> u64

Raw codec value (u64)

Source

pub fn codec_type(&self) -> Codec

Codec as typed enum

Source

pub fn data(&self) -> &[u8]

Data bytes (without codec prefix)

Source

pub fn as_bytes(&self) -> &[u8]

Returns the raw bytes, including the codec prefix

Trait Implementations§

Source§

impl AsRef<MultiEncoded> for MultiEncodedBuf

Source§

fn as_ref(&self) -> &MultiEncoded

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

impl Drop for MultiEncoded

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Zeroize for MultiEncoded

Source§

fn zeroize(&mut self)

Zero out this object from memory using Rust intrinsics which ensure the zeroization operation is not “optimized away” by the compiler.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

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

Mutably borrows from an owned value. Read more