pub enum GitCommitHash {
Sha1([u8; 20]),
Sha256([u8; 32]),
}Expand description
A Git commit hash.
This type guarantees the contained value is either:
- 20 bytes (SHA-1, displayed as 40 lowercase hex characters)
- 32 bytes (SHA-256, displayed as 64 lowercase hex characters)
§Parsing
Parse from a hex string using FromStr:
use git_stub::GitCommitHash;
let hash: GitCommitHash =
"0123456789abcdef0123456789abcdef01234567".parse().unwrap();Variants§
Sha1([u8; 20])
A SHA-1 hash: the one traditionally used in Git.
Sha256([u8; 32])
A SHA-256 hash, supported by newer versions of Git.
Trait Implementations§
Source§impl Clone for GitCommitHash
impl Clone for GitCommitHash
Source§fn clone(&self) -> GitCommitHash
fn clone(&self) -> GitCommitHash
Returns a duplicate of the value. Read more
1.0.0 · 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 GitCommitHash
impl Debug for GitCommitHash
Source§impl Display for GitCommitHash
impl Display for GitCommitHash
Source§impl FromStr for GitCommitHash
impl FromStr for GitCommitHash
Source§impl Hash for GitCommitHash
impl Hash for GitCommitHash
Source§impl Ord for GitCommitHash
impl Ord for GitCommitHash
Source§fn cmp(&self, other: &GitCommitHash) -> Ordering
fn cmp(&self, other: &GitCommitHash) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for GitCommitHash
impl PartialEq for GitCommitHash
Source§impl PartialOrd for GitCommitHash
impl PartialOrd for GitCommitHash
impl Copy for GitCommitHash
impl Eq for GitCommitHash
impl StructuralPartialEq for GitCommitHash
Auto Trait Implementations§
impl Freeze for GitCommitHash
impl RefUnwindSafe for GitCommitHash
impl Send for GitCommitHash
impl Sync for GitCommitHash
impl Unpin for GitCommitHash
impl UnsafeUnpin for GitCommitHash
impl UnwindSafe for GitCommitHash
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