pub struct GitOid(/* private fields */);Expand description
Git object id, 40 lowercase hex digits (SHA-1 repositories; other lengths are rejected; SHA-256 repositories are not accepted).
Implementations§
Source§impl GitOid
impl GitOid
pub fn from_bytes(bytes: [u8; 20]) -> Self
Sourcepub fn parse(raw: &str) -> Option<Self>
pub fn parse(raw: &str) -> Option<Self>
The hex spelling, read back.
Public because a checkpoint identity travels as a string in more
than one direction: the wire deserialises one, and a client that
was shown a checkpoint in a sentence has to turn it back into an
oid to act on it. Without this the caller decodes its own hex,
which is a second definition of what an oid looks like - the exact
thing the note on Deserialize below says stays here.
None on anything that is not exactly forty lowercase hex digits:
a wrong length is a refusal, never a padded guess.
Trait Implementations§
impl Copy for GitOid
Source§impl<'de> Deserialize<'de> for GitOid
impl<'de> Deserialize<'de> for GitOid
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
The shape authority stays here, so the wire (wire::frames) has no
second definition of what an oid looks like.