pub struct FileView<'a> { /* private fields */ }Expand description
An immutable view to a MIDAS file.
A files is a collection of EventViews wrapped by two dumps of the Online
Data Base (ODB) at the beginning and end of the sub-run. The binary
representation of a file is:
| Byte Offset | Size (in bytes) | Description |
|---|---|---|
| 0 | 2 | Begin-of-run marker (0x8000) |
| 2 | 2 | Magic-midas marker (0x494D) |
| 4 | 4 | Run number |
| 8 | 4 | Initial unix timestamp |
| 12 | 4 | Initial ODB dump size (n) |
| 16 | n | Initial ODB dump |
16 + n | m | Events |
16 + n + m | 2 | End-of-run marker (0x8001) |
18 + n + m | 2 | Magic-midas marker (0x494D) |
20 + n + m | 4 | Run number |
24 + n + m | 4 | Final unix timestamp |
28 + n + m | 4 | Final ODB dump size (k) |
32 + n + m | k | Final ODB dump |
Implementations§
source§impl<'a> FileView<'a>
impl<'a> FileView<'a>
sourcepub fn try_from_bytes(
bytes: &'a [u8]
) -> Result<Self, TryFileViewFromBytesError>
pub fn try_from_bytes( bytes: &'a [u8] ) -> Result<Self, TryFileViewFromBytesError>
Create a native view to the underlying file from its representation as a byte slice. Endianness is determined from the begin-of-run marker.
sourcepub fn run_number(&self) -> u32
pub fn run_number(&self) -> u32
Return the run number associated with the file.
sourcepub fn initial_timestamp(&self) -> u32
pub fn initial_timestamp(&self) -> u32
Return the unix timestamp of the initial ODB dump.
sourcepub fn initial_odb(&self) -> &'a [u8] ⓘ
pub fn initial_odb(&self) -> &'a [u8] ⓘ
Return the initial ODB dump. This is not guaranteed to be valid ASCII nor UTF-8.
sourcepub fn final_timestamp(&self) -> u32
pub fn final_timestamp(&self) -> u32
Return the unix timestamp of the final ODB dump.
Trait Implementations§
source§impl<'a, 'b> IntoIterator for &'b FileView<'a>
impl<'a, 'b> IntoIterator for &'b FileView<'a>
source§impl<'a> IntoIterator for FileView<'a>
impl<'a> IntoIterator for FileView<'a>
source§impl<'a, 'b> IntoParallelIterator for &'b FileView<'a>
Available on crate feature rayon only.
impl<'a, 'b> IntoParallelIterator for &'b FileView<'a>
Available on crate feature
rayon only.source§impl<'a> IntoParallelIterator for FileView<'a>
Available on crate feature rayon only.
impl<'a> IntoParallelIterator for FileView<'a>
Available on crate feature
rayon only.Auto Trait Implementations§
impl<'a> RefUnwindSafe for FileView<'a>
impl<'a> Send for FileView<'a>
impl<'a> Sync for FileView<'a>
impl<'a> Unpin for FileView<'a>
impl<'a> UnwindSafe for FileView<'a>
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
source§impl<'data, I> IntoParallelRefIterator<'data> for I
impl<'data, I> IntoParallelRefIterator<'data> for I
§type Iter = <&'data I as IntoParallelIterator>::Iter
type Iter = <&'data I as IntoParallelIterator>::Iter
The type of the parallel iterator that will be returned.
§type Item = <&'data I as IntoParallelIterator>::Item
type Item = <&'data I as IntoParallelIterator>::Item
The type of item that the parallel iterator will produce.
This will typically be an
&'data T reference type.