pub struct MultiEncodedBuf(/* private fields */);Expand description
A multicodec-encoded byte buffer (owned)
Implementations§
Source§impl MultiEncodedBuf
impl MultiEncodedBuf
Sourcepub fn new(bytes: Vec<u8>) -> Result<Self, EncodingError>
pub fn new(bytes: Vec<u8>) -> Result<Self, EncodingError>
Parse an existing multicodec-encoded buffer
Sourcepub fn encode_bytes(codec: u64, bytes: &[u8]) -> Self
pub fn encode_bytes(codec: u64, bytes: &[u8]) -> Self
Encode bytes with a raw codec value (backwards-compatible alias)
Sourcepub fn encode_raw(codec: u64, bytes: &[u8]) -> Self
pub fn encode_raw(codec: u64, bytes: &[u8]) -> Self
Encode bytes with a raw codec value
Sourcepub fn into_bytes(self) -> Vec<u8> ⓘ
pub fn into_bytes(self) -> Vec<u8> ⓘ
Returns the raw bytes, including the codec prefix Note: clones due to ZeroizeOnDrop
Sourcepub fn as_multi_encoded(&self) -> &MultiEncoded
pub fn as_multi_encoded(&self) -> &MultiEncoded
Borrow as MultiEncoded slice
Trait Implementations§
Source§impl AsRef<MultiEncoded> for MultiEncodedBuf
impl AsRef<MultiEncoded> for MultiEncodedBuf
Source§fn as_ref(&self) -> &MultiEncoded
fn as_ref(&self) -> &MultiEncoded
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl Clone for MultiEncodedBuf
impl Clone for MultiEncodedBuf
Source§fn clone(&self) -> MultiEncodedBuf
fn clone(&self) -> MultiEncodedBuf
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 Drop for MultiEncodedBuf
impl Drop for MultiEncodedBuf
Auto Trait Implementations§
impl Freeze for MultiEncodedBuf
impl RefUnwindSafe for MultiEncodedBuf
impl Send for MultiEncodedBuf
impl Sync for MultiEncodedBuf
impl Unpin for MultiEncodedBuf
impl UnwindSafe for MultiEncodedBuf
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