pub struct LengthPrefixed<T>(pub T);
Expand description
A length-prefixed value.
Tuple Fields§
§0: T
Trait Implementations§
Source§impl<T> Clone for LengthPrefixed<T>where
T: Clone,
impl<T> Clone for LengthPrefixed<T>where
T: Clone,
Source§fn clone(&self) -> LengthPrefixed<T>
fn clone(&self) -> LengthPrefixed<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<T> DataType for LengthPrefixed<T>where
T: DataType,
impl<T> DataType for LengthPrefixed<T>where
T: DataType,
const META: StructFieldMeta = T::META
fn encode_usize(buf: &mut BufWriter<'_>, value: usize)
fn decode_usize(buf: &mut &[u8]) -> Result<usize, ParseError>
Source§impl<T> Debug for LengthPrefixed<T>where
T: Debug,
impl<T> Debug for LengthPrefixed<T>where
T: Debug,
Source§impl<'a, T> DecoderFor<'a, LengthPrefixed<T>> for LengthPrefixed<T>where
T: DecoderFor<'a, T>,
impl<'a, T> DecoderFor<'a, LengthPrefixed<T>> for LengthPrefixed<T>where
T: DecoderFor<'a, T>,
fn decode_for(buf: &mut &'a [u8]) -> Result<LengthPrefixed<T>, ParseError>
Source§impl<T> Default for LengthPrefixed<T>where
T: Default,
impl<T> Default for LengthPrefixed<T>where
T: Default,
Source§fn default() -> LengthPrefixed<T>
fn default() -> LengthPrefixed<T>
Returns the “default value” for a type. Read more
Source§impl<T> Deref for LengthPrefixed<T>
impl<T> Deref for LengthPrefixed<T>
Source§impl<T> DerefMut for LengthPrefixed<T>
impl<T> DerefMut for LengthPrefixed<T>
Source§impl<T> Display for LengthPrefixed<T>where
T: Display,
impl<T> Display for LengthPrefixed<T>where
T: Display,
Source§impl<T, U> EncoderFor<LengthPrefixed<T>> for LengthPrefixed<U>where
U: EncoderFor<T>,
T: 'static,
impl<T, U> EncoderFor<LengthPrefixed<T>> for LengthPrefixed<U>where
U: EncoderFor<T>,
T: 'static,
fn encode_for(&self, buf: &mut BufWriter<'_>)
Source§impl<T> PartialEq for LengthPrefixed<T>where
T: PartialEq,
impl<T> PartialEq for LengthPrefixed<T>where
T: PartialEq,
impl<T> Copy for LengthPrefixed<T>where
T: Copy,
impl<T> Eq for LengthPrefixed<T>where
T: Eq,
impl<T> StructuralPartialEq for LengthPrefixed<T>
Auto Trait Implementations§
impl<T> Freeze for LengthPrefixed<T>where
T: Freeze,
impl<T> RefUnwindSafe for LengthPrefixed<T>where
T: RefUnwindSafe,
impl<T> Send for LengthPrefixed<T>where
T: Send,
impl<T> Sync for LengthPrefixed<T>where
T: Sync,
impl<T> Unpin for LengthPrefixed<T>where
T: Unpin,
impl<T> UnwindSafe for LengthPrefixed<T>where
T: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> EncoderForExt for Twhere
T: ?Sized,
impl<T> EncoderForExt for Twhere
T: ?Sized,
Source§fn to_vec<F>(&self) -> Vec<u8> ⓘwhere
F: 'static,
Self: EncoderFor<F>,
fn to_vec<F>(&self) -> Vec<u8> ⓘwhere
F: 'static,
Self: EncoderFor<F>,
Convert this builder into a vector of bytes. This is generally
not the most efficient way to perform serialization.
Source§fn encode_buffer<F>(&self, buf: &mut [u8]) -> Result<usize, usize>where
F: 'static,
Self: EncoderFor<F>,
fn encode_buffer<F>(&self, buf: &mut [u8]) -> Result<usize, usize>where
F: 'static,
Self: EncoderFor<F>,
Encode this builder into a given buffer. If the buffer is
too small, the function will return the number of bytes
required to encode the builder.
Source§fn encode_buffer_uninit<'a, F>(
&self,
buf: &'a mut [MaybeUninit<u8>],
) -> Result<&'a mut [u8], usize>where
F: 'static,
Self: EncoderFor<F>,
fn encode_buffer_uninit<'a, F>(
&self,
buf: &'a mut [MaybeUninit<u8>],
) -> Result<&'a mut [u8], usize>where
F: 'static,
Self: EncoderFor<F>,
Encode this builder into a given buffer. If the buffer is
too small, the function will return the number of bytes
required to encode the builder.