Skip to main content

FileReader

Struct FileReader 

Source
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

Source

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

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> FmtResult

Formats the value using the given formatter. Read more
Source§

impl Input for FileReader

Source§

type Item = u8

The item type read from this input.
Source§

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>

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>

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>

Reads items into an indexed output range until it is full or EOF is reached. Read more
Source§

fn read_fully(&mut self, output: &mut [Self::Item]) -> Result<usize, Error>

Reads items into the full output slice until it is full or EOF is reached. Read more
Source§

fn read_exactly(&mut self, output: &mut [Self::Item]) -> Result<(), Error>

Reads items until the full output slice is filled. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.