Struct git_ref::packed::Buffer

source ·
pub struct Buffer { /* private fields */ }
Expand description

A buffer containing a packed-ref file that is either memory mapped or fully in-memory depending on a cutoff.

The buffer is guaranteed to be sorted as per the packed-ref rules which allows some operations to be more efficient.

Implementations

packed-refs specific functionality

Return an iterator of references stored in this packed refs buffer, ordered by reference name.

Note

There is no namespace support in packed iterators. It can be emulated using iter_prefixed(…).

Return an iterator yielding only references matching the given prefix, ordered by reference name.

Initialization

Open the file at path and map it into memory if the file size is larger than use_memory_map_if_larger_than_bytes.

In order to allow fast lookups and optimizations, the contents of the packed refs must be sorted. If that’s not the case, they will be sorted on the fly with the data being written into a memory buffer.

packed-refs specific functionality

Find a reference with the given name and return it.

Note that it will look it up verbatim and does not deal with namespaces or special prefixes like main-worktree/ or worktrees/<name>/, as this is left to the caller.

Find a reference with the given name and return it.

Trait Implementations

Converts this type into a shared reference of the (usually inferred) input type.
Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Encode the hex strict representing self into the result. Lower case letters are used (e.g. f9b4ca) Read more
Encode the hex strict representing self into the result. Upper case letters are used (e.g. F9B4CA) Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.