pub struct Pointer {
pub oid: Oid,
pub size: u64,
pub extensions: Vec<Extension>,
pub canonical: bool,
}Expand description
A parsed git-lfs pointer.
A pointer with size == 0 is an empty pointer: it represents an empty
file and serializes to the empty byte string. The oid field of an empty
pointer is conventionally Oid::EMPTY (SHA-256 of zero bytes).
Fields§
§oid: Oid§size: u64§extensions: Vec<Extension>Sorted by priority ascending. May be empty.
canonical: booltrue if this was decoded from input that exactly matched the
canonical encoding, or if it was constructed programmatically.
Re-encoding a non-canonical parse produces canonical bytes.
Implementations§
Source§impl Pointer
impl Pointer
Sourcepub fn empty() -> Self
pub fn empty() -> Self
The empty pointer (size 0, OID Oid::EMPTY, no extensions). This is
the parse result for empty input and the pointer representation of an
empty file.
Sourcepub fn encode(&self) -> String
pub fn encode(&self) -> String
Encode to canonical text form. The empty pointer encodes to "".
Extensions are emitted sorted by priority. The version line is always
VERSION_LATEST, regardless of what the source used.
Sourcepub fn parse(input: &[u8]) -> Result<Self, DecodeError>
pub fn parse(input: &[u8]) -> Result<Self, DecodeError>
Parse a pointer from the raw bytes of a blob.
Returns DecodeError::NotAPointer if the input doesn’t look like a
pointer at all (callers like the smudge filter should pass the bytes
through unchanged), or DecodeError::Malformed if the input has
pointer shape but invalid contents (callers should error out).