pub struct BlockHeader {
pub id: String,
pub reserved: u32,
pub length: u64,
pub link_count: u64,
}Fields§
§id: String4-byte block type identifier (e.g., “##HD”, “##DG”).
reserved: u32Reserved field, always 0.
length: u64Total length of the block in bytes, including this header.
link_count: u64Number of link fields in this block.
Implementations§
Source§impl BlockHeader
impl BlockHeader
Sourcepub fn to_bytes(&self) -> Result<Vec<u8>>
pub fn to_bytes(&self) -> Result<Vec<u8>>
Serializes the BlockHeader to bytes according to MDF 4.1 specification.
The BlockHeader is always 24 bytes and consists of:
- id: 4 bytes (ASCII characters, must be exactly 4 bytes)
- reserved: 4 bytes (always 0)
- length: 8 bytes (total length of the block including this header)
- link_count: 8 bytes (number of links in this block)
§Returns
Ok(Vec<u8>)containing the serialized block headerErr(Error)if serialization fails
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self>
pub fn from_bytes(bytes: &[u8]) -> Result<Self>
Parse a block header from the first 24 bytes of bytes.
§Arguments
bytes- Slice containing at least 24 bytes from the MDF file.
§Returns
A BlockHeader on success or Error::TooShortBuffer when the
slice is smaller than 24 bytes.
Trait Implementations§
Source§impl Clone for BlockHeader
impl Clone for BlockHeader
Source§fn clone(&self) -> BlockHeader
fn clone(&self) -> BlockHeader
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BlockHeader
impl Debug for BlockHeader
Source§impl Default for BlockHeader
impl Default for BlockHeader
Source§impl<'de> Deserialize<'de> for BlockHeader
impl<'de> Deserialize<'de> for BlockHeader
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for BlockHeader
impl RefUnwindSafe for BlockHeader
impl Send for BlockHeader
impl Sync for BlockHeader
impl Unpin for BlockHeader
impl UnwindSafe for BlockHeader
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