Skip to main content

DataBlock

Struct DataBlock 

Source
pub struct DataBlock<'a> {
    pub header: BlockHeader,
    pub data: &'a [u8],
}

Fields§

§header: BlockHeader§data: &'a [u8]

Implementations§

Source§

impl<'a> DataBlock<'a>

Source

pub fn records(&self, record_size: usize) -> impl Iterator<Item = &'a [u8]>

Iterate over raw records of fixed size. If the data block contains padding at the end, it’s your caller’s responsibility to trim that.

§Arguments
  • record_size - Size in bytes of one record (including record ID)
§Returns

An iterator yielding each raw record slice.

Trait Implementations§

Source§

impl<'a> BlockParse<'a> for DataBlock<'a>

Source§

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

Parse a DTBLOCK or DVBLOCK from the given byte slice.

Both ##DT (record data) and ##DV (sample data of a column-oriented group) blocks share the same layout: a 24-byte header followed by raw data. Any other block id is rejected.

The slice must contain at least the number of bytes specified by the block length in the header. Only a reference to the data portion is stored to avoid unnecessary allocations.

Source§

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

Source§

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

Source§

impl<'a> Debug for DataBlock<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Forget for DataBlock<'a>

§

impl<'a> Freeze for DataBlock<'a>

§

impl<'a> Move for DataBlock<'a>

§

impl<'a> RefUnwindSafe for DataBlock<'a>

§

impl<'a> Send for DataBlock<'a>

§

impl<'a> Sync for DataBlock<'a>

§

impl<'a> Unpin for DataBlock<'a>

§

impl<'a> UnsafeUnpin for DataBlock<'a>

§

impl<'a> UnwindSafe for DataBlock<'a>

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.