Skip to main content

HeaderBlock

Struct HeaderBlock 

Source
pub struct HeaderBlock {
Show 16 fields pub header: BlockHeader, pub first_dg_addr: u64, pub file_history_addr: u64, pub channel_tree_addr: u64, pub first_attachment_addr: u64, pub first_event_addr: u64, pub comment_addr: u64, pub abs_time: u64, pub tz_offset: i16, pub daylight_save_time: i16, pub time_flags: u8, pub time_quality: u8, pub flags: u8, pub reserved1: u8, pub start_angle: u64, pub start_distance: u64,
}

Fields§

§header: BlockHeader§first_dg_addr: u64§file_history_addr: u64§channel_tree_addr: u64§first_attachment_addr: u64§first_event_addr: u64§comment_addr: u64§abs_time: u64§tz_offset: i16§daylight_save_time: i16§time_flags: u8§time_quality: u8§flags: u8§reserved1: u8§start_angle: u64§start_distance: u64

Implementations§

Source§

impl HeaderBlock

Source

pub fn to_bytes(&self) -> Result<Vec<u8>, MdfError>

Serializes the HeaderBlock to bytes according to MDF 4.1 specification.

§Structure (104 bytes total):
  • BlockHeader (24 bytes): Standard block header with id “##HD”
  • Link section (48 bytes): Six 8-byte links to other blocks
    • first_dg_addr: Link to first Data Group block
    • file_history_addr: Link to file history block
    • channel_tree_addr: Link to channel hierarchy tree
    • first_attachment_addr: Link to first attachment block
    • first_event_addr: Link to first event block
    • comment_addr: Link to comment block
  • Time section (16 bytes): Timestamp and timezone information
  • Angle/Distance section (16 bytes): Start values for angle and distance
§Returns
  • Ok(Vec<u8>) containing the serialized header block
  • Err(MdfError) if serialization fails
§Important
  • The header must have id=“##HD” and block_len=104
  • Links will typically be updated after all blocks are written

Trait Implementations§

Source§

impl BlockParse<'_> for HeaderBlock

Source§

fn from_bytes(bytes: &[u8]) -> Result<Self, MdfError>

Creates a HeaderBlock from a 104-byte slice.

Source§

const ID: &'static str = "##HD"

Source§

fn parse_header(bytes: &[u8]) -> Result<BlockHeader, MdfError>

Source§

impl Debug for HeaderBlock

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for HeaderBlock

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.