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 Option<AssocItemContainer>
impl FixedSizeEncoding for Option<AssocItemContainer>
source§impl FixedSizeEncoding for Option<MacroKind>
impl FixedSizeEncoding for Option<MacroKind>
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.