pub enum ReadBackend<'a> {
Slice(&'a [u8]),
Mapped(&'a Mmap),
}Expand description
The concrete byte source used by FileAnalyze.
An enum with two zero-copy variants today; a Streamed variant for
Read + Seek sources is planned but not yet implemented.
Variants§
Slice(&'a [u8])
Bytes already in memory — the classic &[u8] path.
Mapped(&'a Mmap)
Operating-system memory-mapped file. The backing file is opened read-only and the OS faults in pages on demand.
Only available when the mmap feature is enabled (on by default;
disabled for WASM builds).
Implementations§
Trait Implementations§
Source§impl ByteSource for ReadBackend<'_>
impl ByteSource for ReadBackend<'_>
Source§impl<'a> Clone for ReadBackend<'a>
impl<'a> Clone for ReadBackend<'a>
Source§fn clone(&self) -> ReadBackend<'a>
fn clone(&self) -> ReadBackend<'a>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<'a> Copy for ReadBackend<'a>
Source§impl<'a> Debug for ReadBackend<'a>
impl<'a> Debug for ReadBackend<'a>
Source§impl<'a> From<&'a Mmap> for ReadBackend<'a>
Available on crate feature mmap only.
impl<'a> From<&'a Mmap> for ReadBackend<'a>
Available on crate feature
mmap only.Source§impl<'a> From<&'a [u8]> for ReadBackend<'a>
impl<'a> From<&'a [u8]> for ReadBackend<'a>
Source§impl<'a> From<MmapBackend<'a>> for ReadBackend<'a>
Available on crate feature mmap only.
impl<'a> From<MmapBackend<'a>> for ReadBackend<'a>
Available on crate feature
mmap only.Source§fn from(mmap: MmapBackend<'a>) -> Self
fn from(mmap: MmapBackend<'a>) -> Self
Converts to this type from the input type.
Source§impl<'a> From<SliceBackend<'a>> for ReadBackend<'a>
impl<'a> From<SliceBackend<'a>> for ReadBackend<'a>
Source§fn from(slice: SliceBackend<'a>) -> Self
fn from(slice: SliceBackend<'a>) -> Self
Converts to this type from the input type.
Source§impl MediaReadAt for ReadBackend<'_>
impl MediaReadAt for ReadBackend<'_>
Source§fn read_at(
&self,
range: ByteRange,
dst: &mut [u8],
) -> Result<usize, ReadAtError>
fn read_at( &self, range: ByteRange, dst: &mut [u8], ) -> Result<usize, ReadAtError>
Copy exactly
range.len bytes into dst.Source§fn window_at(&self, range: ByteRange) -> Result<&[u8], ReadAtError>
fn window_at(&self, range: ByteRange) -> Result<&[u8], ReadAtError>
Borrow exactly
range.len bytes from the source.Source§fn window_at_partial(&self, range: ByteRange) -> Result<&[u8], ReadAtError>
fn window_at_partial(&self, range: ByteRange) -> Result<&[u8], ReadAtError>
Borrow up to
range.len bytes. The offset must still be in bounds.Source§fn as_contiguous(&self) -> Option<&[u8]>
fn as_contiguous(&self) -> Option<&[u8]>
Return the complete contiguous source only for compatibility paths.
fn is_empty(&self) -> bool
fn stats(&self) -> SourceStats
Auto Trait Implementations§
impl<'a> Freeze for ReadBackend<'a>
impl<'a> RefUnwindSafe for ReadBackend<'a>
impl<'a> Send for ReadBackend<'a>
impl<'a> Sync for ReadBackend<'a>
impl<'a> Unpin for ReadBackend<'a>
impl<'a> UnsafeUnpin for ReadBackend<'a>
impl<'a> UnwindSafe for ReadBackend<'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