pub struct CommitOid(/* private fields */);Expand description
A validated Git commit object identifier (SHA-1 or SHA-256 hex string).
Accepts exactly 40 lowercase hex characters (SHA-1) or 64 (SHA-256).
Implementations§
Source§impl CommitOid
impl CommitOid
Sourcepub fn parse(raw: &str) -> Result<Self, CommitOidError>
pub fn parse(raw: &str) -> Result<Self, CommitOidError>
Parses and validates a commit OID string.
Args:
raw: A hex string that must be exactly 40 or 64 lowercase hex characters.
Usage:
ⓘ
let oid = CommitOid::parse("a".repeat(40))?;Sourcepub fn new_unchecked(s: impl Into<String>) -> Self
pub fn new_unchecked(s: impl Into<String>) -> Self
Creates a CommitOid without validation.
Only use at deserialization boundaries where the value was previously validated.
Sourcepub fn into_inner(self) -> String
pub fn into_inner(self) -> String
Consumes self and returns the inner String.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for CommitOid
impl<'de> Deserialize<'de> for CommitOid
Source§fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
impl Eq for CommitOid
impl StructuralPartialEq for CommitOid
Auto Trait Implementations§
impl Freeze for CommitOid
impl RefUnwindSafe for CommitOid
impl Send for CommitOid
impl Sync for CommitOid
impl Unpin for CommitOid
impl UnsafeUnpin for CommitOid
impl UnwindSafe for CommitOid
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