pub struct SnapshotContentProvider<'a> { /* private fields */ }Expand description
Reads only files recorded in one validated ScanReport.
Implementations§
Source§impl<'a> SnapshotContentProvider<'a>
impl<'a> SnapshotContentProvider<'a>
Sourcepub fn new(report: &'a ScanReport) -> Result<Self, SnapshotReadError>
pub fn new(report: &'a ScanReport) -> Result<Self, SnapshotReadError>
Validates a scan report before any content is opened.
§Errors
Returns SnapshotReadError::InvalidReport when report entries are
not strictly sorted, escape the root, or lack snapshot evidence.
Sourcepub fn read(&self, relative: &str) -> Result<SnapshotContent, SnapshotReadError>
pub fn read(&self, relative: &str) -> Result<SnapshotContent, SnapshotReadError>
Reads a selected file and verifies it before and after the read.
§Errors
Returns UnknownFile for paths outside this snapshot, Stale when the
file changed or became a link, and Io for independent read failures.
Sourcepub fn read_bounded(
&self,
relative: &str,
max_bytes: u64,
) -> Result<SnapshotContent, SnapshotReadError>
pub fn read_bounded( &self, relative: &str, max_bytes: u64, ) -> Result<SnapshotContent, SnapshotReadError>
Reads a selected file only when its recorded size is within max_bytes.
§Errors
Returns the same failures as Self::read, plus LimitExceeded.
Trait Implementations§
Source§impl<'a> Clone for SnapshotContentProvider<'a>
impl<'a> Clone for SnapshotContentProvider<'a>
Source§fn clone(&self) -> SnapshotContentProvider<'a>
fn clone(&self) -> SnapshotContentProvider<'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 SnapshotContentProvider<'a>
Auto Trait Implementations§
impl<'a> Freeze for SnapshotContentProvider<'a>
impl<'a> RefUnwindSafe for SnapshotContentProvider<'a>
impl<'a> Send for SnapshotContentProvider<'a>
impl<'a> Sync for SnapshotContentProvider<'a>
impl<'a> Unpin for SnapshotContentProvider<'a>
impl<'a> UnsafeUnpin for SnapshotContentProvider<'a>
impl<'a> UnwindSafe for SnapshotContentProvider<'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