pub struct MultiEncodedBuf(/* private fields */);Implementations§
Source§impl MultiEncodedBuf
impl MultiEncodedBuf
Sourcepub fn new(bytes: Vec<u8>) -> Result<Self, Error>
pub fn new(bytes: Vec<u8>) -> Result<Self, Error>
Creates a new multi-encoded slice from the given bytes.
Following the [unsigned-varint] specification and to avoid memory
attacks, the coded must be encoded on at most 9 bytes (63 bits unsigned
varint).
pub fn encode_bytes(codec: u64, bytes: &[u8]) -> Self
pub fn encode<T: MultiCodec>(value: &T) -> Self
Sourcepub unsafe fn new_unchecked(bytes: Vec<u8>) -> Self
pub unsafe fn new_unchecked(bytes: Vec<u8>) -> Self
Creates a new multi-encoded slice from the given bytes without
checking the codec.
§Safety
Following the [unsigned-varint] specification and to avoid memory
attacks, the coded must be encoded on at most 9 bytes (63 bits unsigned
varint).
pub fn as_multi_encoded(&self) -> &MultiEncoded
Sourcepub fn into_bytes(self) -> Vec<u8> ⓘ
pub fn into_bytes(self) -> Vec<u8> ⓘ
Returns the raw bytes, including the codec prefix.
Methods from Deref<Target = MultiEncoded>§
Trait Implementations§
Source§impl AsRef<[u8]> for MultiEncodedBuf
impl AsRef<[u8]> for MultiEncodedBuf
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 moreAuto 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