Skip to main content

ObjectReader

Struct ObjectReader 

Source
pub struct ObjectReader<'repo, R: Repository + ?Sized> { /* private fields */ }
Expand description

A cursor over a stable repository object. It contains only a repository reference, index, metadata, and offset, with no body buffer or allocation. Use core::mem::size_of::<ObjectReader<'_, R>>() for the host’s state budget.

Implementations§

Source§

impl<'repo, R: Repository + ?Sized> ObjectReader<'repo, R>

Source

pub fn new(repository: &'repo R, index: usize) -> Result<Self>

Source

pub fn info(&self) -> ObjectInfo

Source

pub fn object_format(&self) -> ObjectFormat

Source

pub fn position(&self) -> u64

Source

pub fn remaining(&self) -> u64

Source

pub fn seek(&mut self, position: u64) -> Result<()>

Resume or reread at an offset within the body, including EOF.

Source

pub fn read(&mut self, storage: &mut [u8]) -> Result<usize>

Read one bounded chunk. Empty scratch is an error unless at EOF. Early EOF or a provider reporting more bytes than requested is InvalidObject. On error the position is unchanged, so a stable provider can be retried.

Auto Trait Implementations§

§

impl<'repo, R> Freeze for ObjectReader<'repo, R>
where &'repo R: Freeze, R: ?Sized,

§

impl<'repo, R> RefUnwindSafe for ObjectReader<'repo, R>

§

impl<'repo, R> Send for ObjectReader<'repo, R>
where &'repo R: Send, R: ?Sized,

§

impl<'repo, R> Sync for ObjectReader<'repo, R>
where &'repo R: Sync, R: ?Sized,

§

impl<'repo, R> Unpin for ObjectReader<'repo, R>
where &'repo R: Unpin, R: ?Sized,

§

impl<'repo, R> UnsafeUnpin for ObjectReader<'repo, R>

§

impl<'repo, R> UnwindSafe for ObjectReader<'repo, R>

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> Same for T

Source§

type Output = T

Should always be Self
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.