Skip to main content

Decoder

Struct Decoder 

Source
pub struct Decoder<'a> { /* private fields */ }
Expand description

Push-driven SHA-1/SHA-256 pack decoder with fixed inline state and one caller-owned 32 KiB inflate window. Neither input nor output is retained. Supports plain, offset-delta and reference-delta entries, including thin packs; checking base existence and graph connectivity is a host operation.

Preserve the unconsumed input suffix between calls. EntryEnd can include the final body fragment in written; persist it before handling the event. Every error is terminal, and all previously staged data must be discarded. No ref may be published before Finished and host object/graph validation.

Implementations§

Source§

impl<'a> Decoder<'a>

Source

pub fn new( format: ObjectFormat, window: &'a mut [u8; 32768], limits: DecodeLimits, ) -> Self

Source

pub fn position(&self) -> u64

Source

pub fn update( &mut self, input: &[u8], output: &mut [u8], end_of_input: bool, ) -> Result<DecodeProgress>

end_of_input asserts that this slice contains the final available bytes. Events and output exhaustion can return before consuming it all; resubmit the remaining suffix with the same flag. A request for more input at EOF is an error. Bytes after the trailer are always rejected.

Source

pub fn finish(&self) -> Result<ObjectId>

Require a verified trailer. An early call does not invalidate decoding; the host can continue supplying data. Transport EOF remains the host’s responsibility, including checking for data after a verified trailer.

Auto Trait Implementations§

§

impl<'a> !UnwindSafe for Decoder<'a>

§

impl<'a> Freeze for Decoder<'a>

§

impl<'a> RefUnwindSafe for Decoder<'a>

§

impl<'a> Send for Decoder<'a>

§

impl<'a> Sync for Decoder<'a>

§

impl<'a> Unpin for Decoder<'a>

§

impl<'a> UnsafeUnpin for Decoder<'a>

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.