Skip to main content

BlockHeader

Struct BlockHeader 

Source
pub struct BlockHeader {
    pub num_records: u32,
    pub metadata_compression: u8,
    pub bitmap_type: u16,
    pub placeholder1: u8,
    pub block_len: u32,
    pub flags_len: u64,
    pub fields_present: u16,
    pub placeholder2: u16,
    pub placeholder3: u64,
}
Expand description

Block header for encoded data

Always the first 32 bytes at the beginning of a .ahda block.

Must always conform to this format.

The BlockHeader contains the following data:

  • Number of records stored in this block.
  • The metadata compression method used for BlockFlags.
  • Type of bitmap stored in this block.
  • A 1 byte unused placeholder value.
  • The number of bytes in the block contents that follow the BlockFlags bytes.
  • Number of bytes containing the BlockFlags that follow the header.
  • Fields that are present in the BlockFlags.
  • A 2 byte unused placeholder value.
  • A 8 byte unused placeholder value.

Fields§

§num_records: u32

Number of records (queries) stored in this block

§metadata_compression: u8

Compression method used for BlockFlags, see MetadataCompression.

§bitmap_type: u16

Bitmap type used to encode this block, see BitmapType for details.

The address space of the block bitmap type must fit within the file bitmap type specified in crate::headers::file::FileHeader. Given that this is satisfied, the block bitmap type may differ from the file bitmap type.

§placeholder1: u8

Placeholder:

§block_len: u32

Number of bytes in the block contents that follow the flags bytes.

§flags_len: u64

Number of bytes in BlockFlags that follow the header bytes.

§fields_present: u16

BlockFlags fields that are present for records in this block.

Every block must contain at least the fields given in the crate::headers::file::FileHeader fields_present. A block may also contain extra fields that are not specified in crate::headers::file::FileHeader.

§placeholder2: u16

Placeholder

§placeholder3: u64

Placeholder

Implementations§

Source§

impl BlockHeader

Source

pub fn promises_query_names(&self) -> bool

Does the header require the encoded data to contain the query names?

Source

pub fn promises_query_ids(&self) -> bool

Does the header require the encoded data to contain the query indexes?

Trait Implementations§

Source§

impl<'__de, __Context> BorrowDecode<'__de, __Context> for BlockHeader

Source§

fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>( decoder: &mut __D, ) -> Result<Self, DecodeError>

Attempt to decode this type with the given BorrowDecode.
Source§

impl Clone for BlockHeader

Source§

fn clone(&self) -> BlockHeader

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BlockHeader

Source§

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

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

impl<__Context> Decode<__Context> for BlockHeader

Source§

fn decode<__D: Decoder<Context = __Context>>( decoder: &mut __D, ) -> Result<Self, DecodeError>

Attempt to decode this type with the given Decode.
Source§

impl Default for BlockHeader

Source§

fn default() -> BlockHeader

Initialize a header with default values.

Note: This header is not a valid ahda header for most cases. Update the fields accordingly before using.

If you need to encode individual ahda blocks, prefer using pack_records.

Source§

impl Encode for BlockHeader

Source§

fn encode<__E: Encoder>(&self, encoder: &mut __E) -> Result<(), EncodeError>

Encode a given type.
Source§

impl PartialEq for BlockHeader

Source§

fn eq(&self, other: &BlockHeader) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for BlockHeader

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.