pub struct GitOid { /* private fields */ }Expand description
A full Git object identifier.
Implementations§
Source§impl GitOid
impl GitOid
Sourcepub fn new(value: impl AsRef<str>) -> Result<Self, GitOidParseError>
pub fn new(value: impl AsRef<str>) -> Result<Self, GitOidParseError>
Creates a full object identifier from hexadecimal text.
§Errors
Returns GitOidParseError when the text is empty, has an unsupported
length, or contains non-hexadecimal characters.
Sourcepub fn sha1(value: impl AsRef<str>) -> Result<Self, GitOidParseError>
pub fn sha1(value: impl AsRef<str>) -> Result<Self, GitOidParseError>
Creates a SHA-1 object identifier.
§Errors
Returns GitOidParseError when validation fails or the length is not 40.
Sourcepub fn sha256(value: impl AsRef<str>) -> Result<Self, GitOidParseError>
pub fn sha256(value: impl AsRef<str>) -> Result<Self, GitOidParseError>
Creates a SHA-256-shaped object identifier.
§Errors
Returns GitOidParseError when validation fails or the length is not 64.
Sourcepub const fn kind(&self) -> GitOidKind
pub const fn kind(&self) -> GitOidKind
Returns the identifier kind inferred from its length.
Sourcepub fn into_string(self) -> String
pub fn into_string(self) -> String
Consumes the identifier and returns the owned text.
Trait Implementations§
Source§impl Ord for GitOid
impl Ord for GitOid
1.21.0 (const: unstable) · 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 PartialOrd for GitOid
impl PartialOrd for GitOid
impl Eq for GitOid
impl StructuralPartialEq for GitOid
Auto Trait Implementations§
impl Freeze for GitOid
impl RefUnwindSafe for GitOid
impl Send for GitOid
impl Sync for GitOid
impl Unpin for GitOid
impl UnsafeUnpin for GitOid
impl UnwindSafe for GitOid
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