Skip to main content

Pack

Struct Pack 

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

解析済みの packfile。data は pack 全体 (header と trailer を含む)。

Implementations§

Source§

impl<'a> Pack<'a>

Source

pub fn parse(data: &'a [u8]) -> Result<Self>

Source

pub fn parse_with_cache(data: &'a [u8], cache_bytes: usize) -> Result<Self>

Pack::parse の base cache 予算を指定する版。0 で cache を無効化する (メモリの厳しい環境向け。解析時間は delta chain の重複分だけ延びる)。

Source

pub fn len(&self) -> usize

pack 内の object 数。

Source

pub fn is_empty(&self) -> bool

Source

pub fn contains(&self, oid: &Oid) -> bool

Source

pub fn oids(&self) -> impl Iterator<Item = &Oid>

pack 内の全 oid (oid 順)。

Source

pub fn read_object(&self, oid: &Oid) -> Result<Option<(Kind, Vec<u8>)>>

object を読み出す (delta は都度解決する)。

Trait Implementations§

Source§

impl Odb for Pack<'_>

Source§

fn read(&self, oid: &Oid) -> Option<(Kind, Vec<u8>)>

oid に対応する object の種別と内容 (header を除いた body) を返す。 存在しない場合は None。

Auto Trait Implementations§

§

impl<'a> Freeze for Pack<'a>

§

impl<'a> RefUnwindSafe for Pack<'a>

§

impl<'a> Send for Pack<'a>

§

impl<'a> Sync for Pack<'a>

§

impl<'a> Unpin for Pack<'a>

§

impl<'a> UnsafeUnpin for Pack<'a>

§

impl<'a> UnwindSafe for Pack<'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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.