pub struct PackStreamScanner { /* private fields */ }Expand description
Incremental object counter over a pack byte stream.
Feed it the pack’s bytes in order, starting at the PACK signature, in
chunks of any size; Self::counts reports how many entries have been
fully received.
Implementations§
Source§impl PackStreamScanner
impl PackStreamScanner
Sourcepub fn new(hash: HashAlgo) -> Self
pub fn new(hash: HashAlgo) -> Self
Create a scanner for a pack whose REF_DELTA bases are hash ids.
§Parameters
hash: the object format of the pack (decides the length of aREF_DELTAentry’s base id).
Sourcepub fn counts(&self) -> Option<ReceivedObjects>
pub fn counts(&self) -> Option<ReceivedObjects>
Objects received so far, or None until the pack header has arrived.
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Whether every object named in the pack header has been received.
Sourcepub fn feed(&mut self, data: &[u8]) -> Result<(), PackStreamScanError>
pub fn feed(&mut self, data: &[u8]) -> Result<(), PackStreamScanError>
Scan the next data bytes of the pack.
§Parameters
data: the bytes that follow everything fed so far.
§Errors
Returns a PackStreamScanError when the bytes are not a well-formed
pack. The scanner should be discarded after an error.
Trait Implementations§
Auto Trait Implementations§
impl !UnwindSafe for PackStreamScanner
impl Freeze for PackStreamScanner
impl RefUnwindSafe for PackStreamScanner
impl Send for PackStreamScanner
impl Sync for PackStreamScanner
impl Unpin for PackStreamScanner
impl UnsafeUnpin for PackStreamScanner
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
Mutably borrows from an owned value. Read more