pub struct PackDecodeCursor<'a> { /* private fields */ }Expand description
A store-less pack decoder that pauses at an unresolved external base.
Self::new performs the same framing and allocation preflight as
decode_entries_with. Each successful entry reaches the sink exactly
once across calls to Self::resume; a missing base leaves its frame at
the cursor so the caller can supply that base and resume. Other errors
end the decode. The same cumulative budget spans every resume call.
Implementations§
Source§impl<'a> PackDecodeCursor<'a>
impl<'a> PackDecodeCursor<'a>
Sourcepub fn new(pack: &'a [u8], limits: DecodeLimits) -> Result<Self, PackError>
pub fn new(pack: &'a [u8], limits: DecodeLimits) -> Result<Self, PackError>
Preflight one content-addressed pack without fetching external bases.
§Errors
Invalid framing, unsupported content, or a decoded-size claim over
limits is returned before the sink observes any entry.
Sourcepub fn set_max_decoded_bytes(&mut self, max: u64) -> Result<(), PackError>
pub fn set_max_decoded_bytes(&mut self, max: u64) -> Result<(), PackError>
Set the remaining decode’s allocation cap. A caller retaining external objects beside this cursor can lower the cap as those objects accumulate. Earlier claims and live bases stay charged.
§Errors
PackError::PackfileTooLarge if bytes already charged exceed
max; the previous cap is kept in that case.
Sourcepub fn resume<B: DeltaBaseSource>(
&mut self,
bases: &mut B,
sink: impl FnMut(DecodedEntry<'_>) -> Result<(), PackError>,
) -> Result<DecodeReport, PackError>
pub fn resume<B: DeltaBaseSource>( &mut self, bases: &mut B, sink: impl FnMut(DecodedEntry<'_>) -> Result<(), PackError>, ) -> Result<DecodeReport, PackError>
Continue from the first unprocessed frame.
§Errors
PackError::DeltaBaseMissing leaves the current frame ready to
retry after bases gains that id. Any other error is terminal. The
sink may have seen earlier entries when either error is returned.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for PackDecodeCursor<'a>
impl<'a> RefUnwindSafe for PackDecodeCursor<'a>
impl<'a> Send for PackDecodeCursor<'a>
impl<'a> Sync for PackDecodeCursor<'a>
impl<'a> Unpin for PackDecodeCursor<'a>
impl<'a> UnsafeUnpin for PackDecodeCursor<'a>
impl<'a> UnwindSafe for PackDecodeCursor<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more