Trait ntfs::NtfsReadSeek
source · pub trait NtfsReadSeek {
// Required methods
fn read<T>(&mut self, fs: &mut T, buf: &mut [u8]) -> Result<usize>
where T: Read + Seek;
fn seek<T>(&mut self, fs: &mut T, pos: SeekFrom) -> Result<u64>
where T: Read + Seek;
fn stream_position(&self) -> u64;
// Provided method
fn read_exact<T>(&mut self, fs: &mut T, buf: &mut [u8]) -> Result<()>
where T: Read + Seek { ... }
}
Expand description
Trait to read/seek in a source by the help of a temporarily passed mutable reference to the filesystem reader.
By requiring the user to pass the filesystem reader on every read, we circumvent the problems associated with permanently holding a mutable reference. If we held one, we could not read from two objects in alternation.
Required Methods§
sourcefn read<T>(&mut self, fs: &mut T, buf: &mut [u8]) -> Result<usize>where
T: Read + Seek,
fn read<T>(&mut self, fs: &mut T, buf: &mut [u8]) -> Result<usize>where T: Read + Seek,
See std::io::Read::read
.
sourcefn seek<T>(&mut self, fs: &mut T, pos: SeekFrom) -> Result<u64>where
T: Read + Seek,
fn seek<T>(&mut self, fs: &mut T, pos: SeekFrom) -> Result<u64>where T: Read + Seek,
See std::io::Seek::seek
.