pub struct Header {Show 21 fields
pub version_major: u16,
pub version_minor: u16,
pub flags: u64,
pub created_at: u64,
pub source_bytes_total: u64,
pub file_count: u32,
pub trigram_count: u32,
pub file_table_offset: u64,
pub file_table_size: u64,
pub trigram_table_offset: u64,
pub trigram_table_size: u64,
pub posting_data_offset: u64,
pub posting_data_size: u64,
pub bloom_offset: u64,
pub bloom_size: u64,
pub string_pool_offset: u64,
pub string_pool_size: u64,
pub name_index_offset: u64,
pub name_index_size: u64,
pub cdx_block_index_offset: u64,
pub cdx_block_index_size: u64,
}Expand description
Parsed contents of the fixed 256-byte index header.
All integer fields are stored little-endian in the file. Offsets are absolute byte offsets from the start of the file.
Fields§
§version_major: u16Format major version (must equal VERSION_MAJOR).
version_minor: u16Format minor version (must be ≥ VERSION_MINOR).
flags: u64Bit-field of feature flags (see flags).
created_at: u64Unix timestamp (seconds) when the index was created.
source_bytes_total: u64Sum of byte-sizes of all source files when indexed.
file_count: u32Number of file entries in the file table.
trigram_count: u32Number of trigram entries in the trigram table.
file_table_offset: u64Byte offset to the file table section.
file_table_size: u64Byte length of the file table section.
trigram_table_offset: u64Byte offset to the trigram lookup table.
trigram_table_size: u64Byte length of the trigram lookup table.
posting_data_offset: u64Byte offset to the posting-list data blob.
posting_data_size: u64Byte length of the posting-list data blob.
bloom_offset: u64Byte offset to the bloom-filter section (0 if absent).
bloom_size: u64Byte length of the bloom-filter section (0 if absent).
string_pool_offset: u64Byte offset to the string pool section.
string_pool_size: u64Byte length of the string pool section.
name_index_offset: u64Byte offset to the file-name index section (0 if absent).
name_index_size: u64Byte length of the file-name index section (0 if absent).
cdx_block_index_offset: u64Byte offset to the CDX block index (0 if absent).
cdx_block_index_size: u64Byte length of the CDX block index (0 if absent).
Implementations§
Source§impl Header
impl Header
Sourcepub fn parse(data: &[u8]) -> Result<Self>
pub fn parse(data: &[u8]) -> Result<Self>
Parse header from the first 256 bytes of an index file.
§Errors
Returns an error if the data is too small, has a bad magic number, unsupported version, or corrupted CRC.
Sourcepub fn validate_bounds(&self, file_len: u64) -> Result<()>
pub fn validate_bounds(&self, file_len: u64) -> Result<()>
Validate all section offsets fit within the file.
§Errors
Returns an error if any section extends beyond the file length.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Header
impl RefUnwindSafe for Header
impl Send for Header
impl Sync for Header
impl Unpin for Header
impl UnsafeUnpin for Header
impl UnwindSafe for Header
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more