pub struct Header {
pub major: u16,
pub minor: u16,
pub mandatory_features: u32,
pub optional_features: u32,
pub exactness_profile: u8,
pub source_format: u8,
pub universe_id: [u8; 16],
pub declared_source_len: u64,
}Expand description
The parsed, validated fixed header.
Fields§
§major: u16Major version.
minor: u16Minor version.
mandatory_features: u32Feature bits a decoder must understand.
optional_features: u32Feature bits a decoder may ignore.
exactness_profile: u8Exactness profile selector (only EXACT_BYTES is normative).
source_format: u8Source-format class selector.
universe_id: [u8; 16]First 16 bytes of SHA-256 over the universe declaration string.
declared_source_len: u64Declared length of the fully reconstructed source.
Implementations§
Source§impl Header
impl Header
Sourcepub fn new(
universe_id: [u8; 16],
declared_source_len: u64,
exactness_profile: u8,
source_format: u8,
) -> Self
pub fn new( universe_id: [u8; 16], declared_source_len: u64, exactness_profile: u8, source_format: u8, ) -> Self
Build a header for the current format version.
Sourcepub fn encode(&self) -> [u8; 64]
pub fn encode(&self) -> [u8; 64]
Encode the header to exactly HEADER_LEN bytes, computing the CRC.
Sourcepub fn decode(bytes: &[u8]) -> Result<Header>
pub fn decode(bytes: &[u8]) -> Result<Header>
Decode and validate the header from the start of bytes.
Sourcepub fn source_format_supported(&self) -> bool
pub fn source_format_supported(&self) -> bool
True if this build has an adapter for the declared source-format class.
Unknown classes fail closed: a descriptor naming a class this build does not implement is refused rather than reinterpreted as opaque.
Trait Implementations§
impl Eq for Header
impl StructuralPartialEq for Header
Auto Trait Implementations§
impl Freeze for Header
impl RefUnwindSafe for Header
impl Send for Header
impl Sync for Header
impl Unpin for Header
impl UnsafeUnpin for Header
impl UnwindSafe for Header
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