Trait rustc_metadata::rmeta::table::FixedSizeEncoding
source · pub(super) trait FixedSizeEncoding: IsDefault {
type ByteArray;
// Required methods
fn from_bytes(b: &Self::ByteArray) -> Self;
fn write_to_bytes(self, b: &mut Self::ByteArray);
}
Expand description
Helper trait, for encoding to, and decoding from, a fixed number of bytes.
Used mainly for Lazy positions and lengths.
Unchecked invariant: Self::default()
should encode as [0; BYTE_LEN]
,
but this has no impact on safety.
Required Associated Types§
Required Methods§
fn from_bytes(b: &Self::ByteArray) -> Self
fn write_to_bytes(self, b: &mut Self::ByteArray)
Implementations on Foreign Types§
source§impl FixedSizeEncoding for bool
impl FixedSizeEncoding for bool
source§impl<T> FixedSizeEncoding for Option<LazyArray<T>>
impl<T> FixedSizeEncoding for Option<LazyArray<T>>
source§impl FixedSizeEncoding for Option<Defaultness>
impl FixedSizeEncoding for Option<Defaultness>
source§impl FixedSizeEncoding for u64
impl FixedSizeEncoding for u64
source§impl FixedSizeEncoding for u32
impl FixedSizeEncoding for u32
This implementation is not used generically, but for reading/writing
concrete u32
fields in Lazy*
structures, which may be zero.