Struct bin_layout::Record
source · [−]pub struct Record<Len: LenType, T> {
pub data: T,
/* private fields */
}Expand description
Record can be used to encode collections where the size of the length is known.
For example, Record<u8, String> here the maximum allowed payload length is 255 (u8::MAX)
Example
use bin_layout::*;
let record: Record<u8, String> = "very long string!".repeat(15).into();
let bytes = record.encode();
assert_eq!(record.len(), 255);
assert_eq!(bytes.len(), 256);Fields
data: TImplementations
Trait Implementations
sourceimpl<'de, Len: LenType, K: Decoder<'de> + Ord, V: Decoder<'de>> Decoder<'de> for Record<Len, BTreeMap<K, V>>
impl<'de, Len: LenType, K: Decoder<'de> + Ord, V: Decoder<'de>> Decoder<'de> for Record<Len, BTreeMap<K, V>>
sourceimpl<'de, Len: LenType, K: Decoder<'de> + Eq + Hash, V: Decoder<'de>, S: BuildHasher + Default> Decoder<'de> for Record<Len, HashMap<K, V, S>>
impl<'de, Len: LenType, K: Decoder<'de> + Eq + Hash, V: Decoder<'de>, S: BuildHasher + Default> Decoder<'de> for Record<Len, HashMap<K, V, S>>
sourceimpl<'de, Len: LenType, T: Decoder<'de> + Eq + Hash, S: BuildHasher + Default> Decoder<'de> for Record<Len, HashSet<T, S>>
impl<'de, Len: LenType, T: Decoder<'de> + Eq + Hash, S: BuildHasher + Default> Decoder<'de> for Record<Len, HashSet<T, S>>
sourceimpl<Len: LenType, T, V: FromIterator<T>> FromIterator<T> for Record<Len, V>
impl<Len: LenType, T, V: FromIterator<T>> FromIterator<T> for Record<Len, V>
sourcefn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
Creates a value from an iterator. Read more
sourceimpl<Len: Ord + LenType, T: Ord> Ord for Record<Len, T>
impl<Len: Ord + LenType, T: Ord> Ord for Record<Len, T>
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl<Len: PartialEq + LenType, T: PartialEq> PartialEq<Record<Len, T>> for Record<Len, T>
impl<Len: PartialEq + LenType, T: PartialEq> PartialEq<Record<Len, T>> for Record<Len, T>
sourceimpl<Len: PartialOrd + LenType, T: PartialOrd> PartialOrd<Record<Len, T>> for Record<Len, T>
impl<Len: PartialOrd + LenType, T: PartialOrd> PartialOrd<Record<Len, T>> for Record<Len, T>
sourcefn partial_cmp(&self, other: &Record<Len, T>) -> Option<Ordering>
fn partial_cmp(&self, other: &Record<Len, T>) -> Option<Ordering>
This method returns an ordering between self and other values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
impl<Len: Eq + LenType, T: Eq> Eq for Record<Len, T>
impl<Len: LenType, T> StructuralEq for Record<Len, T>
impl<Len: LenType, T> StructuralPartialEq for Record<Len, T>
Auto Trait Implementations
impl<Len, T> RefUnwindSafe for Record<Len, T>where
Len: RefUnwindSafe,
T: RefUnwindSafe,
impl<Len, T> Send for Record<Len, T>where
Len: Send,
T: Send,
impl<Len, T> Sync for Record<Len, T>where
Len: Sync,
T: Sync,
impl<Len, T> Unpin for Record<Len, T>where
Len: Unpin,
T: Unpin,
impl<Len, T> UnwindSafe for Record<Len, T>where
Len: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more