#[non_exhaustive]pub enum Kind {
Sha1 = 1,
Sha256 = 2,
}Expand description
Denotes the kind of function to produce a ObjectId.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Sha1 = 1
Available on crate feature
sha1 only.The SHA1 hash with 160 bits.
Sha256 = 2
Available on crate feature
sha256 only.The SHA256 hash with 256 bits.
Implementations§
Source§impl Kind
impl Kind
Sourcepub const fn hex_buf() -> [u8; 64]
pub const fn hex_buf() -> [u8; 64]
Returns a buffer suitable to hold the longest possible hash in hex.
Sourcepub const fn buf() -> [u8; 32]
pub const fn buf() -> [u8; 32]
Returns a buffer suitable to hold the longest possible hash as raw bytes.
Sourcepub const fn len_in_hex(&self) -> usize
pub const fn len_in_hex(&self) -> usize
Returns the amount of bytes needed to encode this instance as hexadecimal characters.
Sourcepub const fn len_in_bytes(&self) -> usize
pub const fn len_in_bytes(&self) -> usize
Returns the amount of bytes taken up by the hash of this instance.
Sourcepub const fn from_hex_len(hex_len: usize) -> Option<Self>
pub const fn from_hex_len(hex_len: usize) -> Option<Self>
Returns the kind of hash that would fit the given hex_len, or None if there is no fitting hash.
Note that 0 as hex_len up to 40 always yields SHA-1 while anything in the range 41..64
always yields SHA-256 if it is enabled.
Sourcepub const fn empty_blob(&self) -> ObjectId
pub const fn empty_blob(&self) -> ObjectId
The hash of an empty blob.
Sourcepub const fn empty_tree(&self) -> ObjectId
pub const fn empty_tree(&self) -> ObjectId
The hash of an empty tree.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Kind
impl<'de> Deserialize<'de> for Kind
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Ord for Kind
impl Ord for Kind
Source§impl PartialOrd for Kind
impl PartialOrd for Kind
impl Copy for Kind
impl Eq for Kind
impl StructuralPartialEq for Kind
Auto Trait Implementations§
impl Freeze for Kind
impl RefUnwindSafe for Kind
impl Send for Kind
impl Sync for Kind
impl Unpin for Kind
impl UnwindSafe for Kind
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