pub struct FileReader { /* private fields */ }Expand description
Type-erased byte input explicitly associated with an opened file.
Aggregate reads retry ordinary interruptions and typed interruptions whose
effect is absent or FsEffectState::Unchanged. A typed interruption with
another effect, or with a conflicting error kind, is returned with outer
IoErrorKind::Other; its original FsError remains the direct error
payload. A failed aggregate read may already have written bytes into its
destination buffer; those bytes are not rolled back.
§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
Reports whether the wrapped byte input can satisfy reads from its buffer.
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 the requested byte range under the caller’s Input safety
contract.
§Parameters
output: Caller-owned destination buffer.index: Start index of the requested output range.count: Number of bytes requested from that range.
§Safety
index..index + count must be a valid range within output, and the
addition must not overflow.