pub struct Header {
pub version: Version,
pub text_offset: RangeInclusive<usize>,
pub data_offset: RangeInclusive<usize>,
pub analysis_offset: RangeInclusive<usize>,
}Expand description
Contains FCS version and byte offsets to text, data, and analysis segments
The header is the first segment of an FCS file (first 58 bytes) and contains:
- The FCS version string (e.g., “FCS3.1”)
- Byte offsets to the TEXT segment (contains metadata/keywords)
- Byte offsets to the DATA segment (contains event data)
- Byte offsets to the ANALYSIS segment (optional, contains analysis results)
Fields§
§version: Version§text_offset: RangeInclusive<usize>§data_offset: RangeInclusive<usize>§analysis_offset: RangeInclusive<usize>Implementations§
Source§impl Header
impl Header
pub const fn new() -> Self
Sourcepub fn from_mmap(mmap: &Mmap) -> Result<Self>
pub fn from_mmap(mmap: &Mmap) -> Result<Self>
Returns a new Header struct from a memory map of an FCS file
§Errors
Will return Err if:
- the FCS version is not valid
- the number of spaces in the header segment is not 4
- the byte offsets for the TEXT, DATA, or ANALYSIS segments are not valid
Sourcepub fn get_version(mmap: &Mmap) -> Result<Version>
pub fn get_version(mmap: &Mmap) -> Result<Version>
Returns the FCS version from the first 6 bytes of the file
§Errors
Will return Err if the version is not valid
Sourcepub fn check_fcs_version(version: &str) -> Result<Version>
pub fn check_fcs_version(version: &str) -> Result<Version>
Returns a valid FCS version enum after checking that the parsed string from the header is valid
§Errors
Will return Err if the version is not valid
Sourcepub fn check_header_spaces(buffer: &[u8]) -> Result<()>
pub fn check_header_spaces(buffer: &[u8]) -> Result<()>
Check for valid number of spaces (4) in the HEADER segment
§Errors
Will return Err if the number of spaces is not 4
Sourcepub fn check_fcs_offsets(mmap: &Mmap) -> Result<()>
pub fn check_fcs_offsets(mmap: &Mmap) -> Result<()>
Debug utility to print FCS file segment offsets
This function prints detailed information about the header segment and the byte offsets for TEXT, DATA, and ANALYSIS segments. Useful for debugging file parsing issues.
§Arguments
mmap- Memory-mapped view of the FCS file
§Errors
Will return Err if offsets cannot be read from the header
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> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
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