pub enum ObjectHeader {
Regular {
obj_type: ObjectType,
uncompressed_data_size: usize,
raw_data: Vec<u8>,
},
OfsDelta {
uncompressed_data_size: usize,
base_offset: i64,
raw_data: Vec<u8>,
},
RefDelta {
uncompressed_data_size: usize,
base_ref: [u8; 20],
raw_data: Vec<u8>,
},
}Variants§
Implementations§
Source§impl ObjectHeader
impl ObjectHeader
pub fn obj_type(&self) -> ObjectType
pub fn uncompressed_data_size(&self) -> usize
pub fn raw_data(&self) -> &[u8] ⓘ
Sourcepub fn parse(input: &[u8]) -> IResult<&[u8], Self>
pub fn parse(input: &[u8]) -> IResult<&[u8], Self>
Every byte of the header has its Most Significant Bit used as a continuation bit: 0 -> this is the last byte 1 -> there is the next byte
After the continuation bit in the first byte there are 3 bits for the type. Type 5 is reserved for future expansion. Type 0 is invalid.
Trait Implementations§
Source§impl Clone for ObjectHeader
impl Clone for ObjectHeader
Source§fn clone(&self) -> ObjectHeader
fn clone(&self) -> ObjectHeader
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ObjectHeader
impl Debug for ObjectHeader
impl Eq for ObjectHeader
Source§impl PartialEq for ObjectHeader
impl PartialEq for ObjectHeader
Source§fn eq(&self, other: &ObjectHeader) -> bool
fn eq(&self, other: &ObjectHeader) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ObjectHeader
Auto Trait Implementations§
impl Freeze for ObjectHeader
impl RefUnwindSafe for ObjectHeader
impl Send for ObjectHeader
impl Sync for ObjectHeader
impl Unpin for ObjectHeader
impl UnsafeUnpin for ObjectHeader
impl UnwindSafe for ObjectHeader
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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>
Converts
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>
Converts
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