pub struct DataReader { /* private fields */ }
Expand description
Manages the reading of static file data using memory-mapped files.
Holds file and mmap descriptors of the data and offsets files of a static_file
.
Implementations§
Source§impl DataReader
impl DataReader
Sourcepub fn new(path: impl AsRef<Path>) -> Result<Self, NippyJarError>
pub fn new(path: impl AsRef<Path>) -> Result<Self, NippyJarError>
Reads the respective data and offsets file and returns DataReader
.
Sourcepub fn offset(&self, index: usize) -> Result<u64, NippyJarError>
pub fn offset(&self, index: usize) -> Result<u64, NippyJarError>
Returns the offset for the requested data index
Sourcepub fn reverse_offset(&self, index: usize) -> Result<u64, NippyJarError>
pub fn reverse_offset(&self, index: usize) -> Result<u64, NippyJarError>
Returns the offset for the requested data index starting from the end
Sourcepub fn offsets_count(&self) -> Result<usize, NippyJarError>
pub fn offsets_count(&self) -> Result<usize, NippyJarError>
Returns total number of offsets in the file. The size of one offset is determined by the file itself.
Sourcepub const fn offset_size(&self) -> u8
pub const fn offset_size(&self) -> u8
Returns number of bytes that represent one offset.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DataReader
impl RefUnwindSafe for DataReader
impl Send for DataReader
impl Sync for DataReader
impl Unpin for DataReader
impl UnwindSafe for DataReader
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 48 bytes