pub struct ReadRoot { /* private fields */ }Expand description
A root for many bounded reads, such as the probes of many candidate
files. The root resolves once, and each directory that holds a missing
candidate resolves once. So a missing candidate costs one lstat call.
A read gives the same result as read_bytes_inside with the same root.
A file system change after a directory resolves is not seen, so keep a
ReadRoot for one scan only.
Implementations§
Source§impl ReadRoot
impl ReadRoot
Sourcepub fn read_bytes(
&self,
path: &Path,
max_bytes: u64,
) -> Result<Vec<u8>, ReadRefusal>
pub fn read_bytes( &self, path: &Path, max_bytes: u64, ) -> Result<Vec<u8>, ReadRefusal>
read_bytes_inside with this root.
§Errors
Returns a ReadRefusal when a check fails or the read fails.
Sourcepub fn read_to_string(
&self,
path: &Path,
max_bytes: u64,
) -> Result<String, ReadRefusal>
pub fn read_to_string( &self, path: &Path, max_bytes: u64, ) -> Result<String, ReadRefusal>
read_to_string_inside with this root.
§Errors
Returns a ReadRefusal when a check fails, the read fails, or the
content is not valid UTF-8.
Sourcepub fn is_inside(&self, path: &Path) -> bool
pub fn is_inside(&self, path: &Path) -> bool
is_inside_root with this root.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ReadRoot
impl !RefUnwindSafe for ReadRoot
impl !Sync for ReadRoot
impl Forget for ReadRoot
impl Move for ReadRoot
impl Send for ReadRoot
impl Unpin for ReadRoot
impl UnsafeUnpin for ReadRoot
impl UnwindSafe for ReadRoot
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