Skip to main content

RangeReader

Struct RangeReader 

Source
pub struct RangeReader<'q, S: RangeSource> { /* private fields */ }
Expand description

One reusable original-file window. Parser lookahead and seek operations share this buffer; large file/stream bodies need not be materialized. Dropping a suspended read releases its scratch with the actual allocation.

Implementations§

Source§

impl<'q, S: RangeSource> RangeReader<'q, S>

Source

pub fn new<W: Work>( source: &'q S, session: &'q Session, operation: &'q W, ) -> Result<Self, InputError<S::Error>>

Creates bounded scratch under the original AND current execution. Construction performs no acquisition and never copies the source.

Source

pub fn stamp(&self) -> Stamp<S::Document, S::Generation>

Original immutable view captured before parsing.

Source

pub fn execution(&self) -> Execution<'q>

Current original/source operation boundary, without a retained clone.

Source

pub async fn byte_at( &mut self, offset: u64, ) -> Result<Option<u8>, InputError<S::Error>>

Reads one original byte, suspending only on a missing window. EOF is separate from source failure, changed snapshot or exhausted work.

§Panics

Panics if an offset inside the bounded resident window cannot index it.

Source

pub async fn decode_bytes( &mut self, body: Span, form: Form, ) -> Result<OwnedVec<u8, Execution<'q>>, ReadFailure<S::Error>>

Decodes an original name/string BODY (without its delimiters) through the same grammar as resident crate::bytes::Bytes. It neither parses the enclosing PDF nor proves that the caller selected a signed field. All output has actual-capacity ownership; failure returns no prefix.

Auto Trait Implementations§

§

impl<'q, S> !Freeze for RangeReader<'q, S>

§

impl<'q, S> !RefUnwindSafe for RangeReader<'q, S>

§

impl<'q, S> !Send for RangeReader<'q, S>

§

impl<'q, S> !Sync for RangeReader<'q, S>

§

impl<'q, S> !UnwindSafe for RangeReader<'q, S>

§

impl<'q, S> Unpin for RangeReader<'q, S>
where Window<'q, S>: Unpin,

§

impl<'q, S> UnsafeUnpin for RangeReader<'q, S>
where Window<'q, S>: UnsafeUnpin,

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.