pub struct FileReader { /* private fields */ }Expand description
Type-erased byte input explicitly associated with an opened file.
§Examples
The example runs against an isolated in-memory fixture. Applications obtain their configured facade from a provider or registry integration.
use qubit_fs::Path;
use qubit_fs::read::ReadOptions;
use qubit_io::Input;
let mut reader = filesystem.open_reader(&Path::parse("/report")?, ReadOptions::default())?;
let mut prefix = [0; 3];
assert_eq!(3, reader.read_fully(&mut prefix)?);
assert_eq!(*b"rep", prefix);Implementations§
Source§impl FileReader
impl FileReader
Sourcepub fn info(&self) -> &OpenedFileInfo
pub fn info(&self) -> &OpenedFileInfo
Returns the fixed identity and open-time metadata snapshot.
§Returns
Information captured when the reader was opened.
Trait Implementations§
Source§impl Debug for FileReader
impl Debug for FileReader
Source§impl Input for FileReader
impl Input for FileReader
Source§fn is_buffered(&self) -> bool
fn is_buffered(&self) -> bool
Returns whether this input already buffers items internally. Read more
Source§unsafe fn read_unchecked(
&mut self,
output: &mut [u8],
index: usize,
count: usize,
) -> IoResult<usize>
unsafe fn read_unchecked( &mut self, output: &mut [u8], index: usize, count: usize, ) -> IoResult<usize>
Reads items into an indexed output range without checking the range. Read more
Source§fn read(&mut self, output: &mut [Self::Item]) -> Result<usize, Error>
fn read(&mut self, output: &mut [Self::Item]) -> Result<usize, Error>
Reads items into the full output slice. Read more
Source§unsafe fn read_fully_unchecked(
&mut self,
output: &mut [Self::Item],
index: usize,
count: usize,
) -> Result<usize, Error>
unsafe fn read_fully_unchecked( &mut self, output: &mut [Self::Item], index: usize, count: usize, ) -> Result<usize, Error>
Reads items into an indexed output range until it is full or EOF is
reached. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for FileReader
impl !Sync for FileReader
impl !UnwindSafe for FileReader
impl Freeze for FileReader
impl Send for FileReader
impl Unpin for FileReader
impl UnsafeUnpin for FileReader
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