pub struct ObjectHeader {
pub version: u8,
pub track_creation_order: bool,
pub messages: Vec<HeaderMessage>,
}Expand description
Parsed object header containing its version and all raw messages.
Fields§
§version: u8Object header version (1 or 2).
track_creation_order: boolWhether creation order is tracked for messages (v2 only, flags bit 2).
messages: Vec<HeaderMessage>All header messages, in order.
Implementations§
Source§impl ObjectHeader
impl ObjectHeader
Sourcepub fn parse(
data: &Bytes,
size_of_offsets: u8,
size_of_lengths: u8,
) -> Result<Self>
pub fn parse( data: &Bytes, size_of_offsets: u8, size_of_lengths: u8, ) -> Result<Self>
Parse an object header from a byte buffer at the given position.
For v2 headers, the data must start with the OHDR signature.
For v1 headers, there is no signature — the version byte comes first.
continuation_fetcher is called when a continuation message is found
and we need to fetch more data from a different file offset. For the
initial parse (from a single prefetched buffer), pass None.
Sourcepub fn find_message(&self, msg_type: u16) -> Option<&HeaderMessage>
pub fn find_message(&self, msg_type: u16) -> Option<&HeaderMessage>
Find the first message of a given type.
Sourcepub fn find_messages(&self, msg_type: u16) -> Vec<&HeaderMessage>
pub fn find_messages(&self, msg_type: u16) -> Vec<&HeaderMessage>
Find all messages of a given type.
Sourcepub fn has_continuation(&self) -> bool
pub fn has_continuation(&self) -> bool
Check if a continuation message is present (meaning we’d need to fetch more data from a different file address).
Trait Implementations§
Source§impl Clone for ObjectHeader
impl Clone for ObjectHeader
Source§fn clone(&self) -> ObjectHeader
fn clone(&self) -> ObjectHeader
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more