Skip to main content

PrefixReadOutcome

Struct PrefixReadOutcome 

Source
pub struct PrefixReadOutcome { /* private fields */ }
Expand description

Bytes read from one opened resource together with bounded-read facts.

LimitReached means the requested bound was consumed without probing for another byte; it does not prove that the stream has ended.

§Examples

use qubit_fs::Path;
use qubit_fs::read::PrefixReadTermination;
use qubit_fs::read::ReadOptions;
let fs = support::rustdoc_provider::filesystem();
let outcome = fs.read_prefix(&Path::parse("/report")?, ReadOptions::default(), 3)?;
assert_eq!(outcome.bytes(), b"rep");
assert_eq!(outcome.termination(), PrefixReadTermination::LimitReached);

Implementations§

Source§

impl PrefixReadOutcome

Source

pub fn bytes(&self) -> &[u8] ⓘ

Returns the bytes without transferring ownership.

Source

pub const fn info(&self) -> &OpenedFileInfo

Returns the information captured when the reader was opened.

Source

pub const fn options(&self) -> &ReadOptions

Returns the caller options retained for this read.

Source

pub const fn max_bytes(&self) -> usize

Returns the requested prefix limit.

Source

pub const fn termination(&self) -> PrefixReadTermination

Returns the reason the read stopped.

Source

pub fn into_bytes(self) -> Vec<u8> ⓘ

Transfers the accumulated bytes without another allocation.

Trait Implementations§

Source§

impl Debug for PrefixReadOutcome

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. 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.