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>
impl<'q, S: RangeSource> RangeReader<'q, S>
Sourcepub fn new<W: Work>(
source: &'q S,
session: &'q Session,
operation: &'q W,
) -> Result<Self, InputError<S::Error>>
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.
Sourcepub fn stamp(&self) -> Stamp<S::Document, S::Generation>
pub fn stamp(&self) -> Stamp<S::Document, S::Generation>
Original immutable view captured before parsing.
Sourcepub fn execution(&self) -> Execution<'q>
pub fn execution(&self) -> Execution<'q>
Current original/source operation boundary, without a retained clone.
Sourcepub async fn byte_at(
&mut self,
offset: u64,
) -> Result<Option<u8>, InputError<S::Error>>
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.
Sourcepub async fn decode_bytes(
&mut self,
body: Span,
form: Form,
) -> Result<OwnedVec<u8, Execution<'q>>, ReadFailure<S::Error>>
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.