pub struct ObjectId(/* private fields */);Expand description
A BLAKE3 hash identifying an object by its content. Two objects with identical content always produce the same ObjectId.
Implementations§
Source§impl ObjectId
impl ObjectId
Sourcepub fn from_bytes(bytes: [u8; 32]) -> Self
pub fn from_bytes(bytes: [u8; 32]) -> Self
Create an ObjectId from raw bytes.
Sourcepub fn to_hex(&self) -> String
pub fn to_hex(&self) -> String
Full 64-character lowercase hex of the 32-byte id, WITHOUT the sg_
display prefix. Useful for prefix matching against a stored id.
Sourcepub fn from_hex(s: &str) -> Option<Self>
pub fn from_hex(s: &str) -> Option<Self>
Parse a full commit id from hex, tolerating an optional sg_ prefix and
surrounding whitespace. Returns None unless the input decodes to
exactly 32 bytes (64 hex chars). For partial ids use ObjectId::to_hex
and compare prefixes.
Sourcepub fn normalize_hex_prefix(s: &str) -> Option<String>
pub fn normalize_hex_prefix(s: &str) -> Option<String>
Normalize a user-supplied commit-ref fragment for prefix matching:
strips an optional sg_ prefix and lowercases. Returns None if the
remainder is empty or contains non-hex characters.
Trait Implementations§
impl Copy for ObjectId
Source§impl<'de> Deserialize<'de> for ObjectId
impl<'de> Deserialize<'de> for ObjectId
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
impl Eq for ObjectId
Source§impl Ord for ObjectId
impl Ord for ObjectId
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
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for ObjectId
impl PartialOrd for ObjectId
impl StructuralPartialEq for ObjectId
Auto Trait Implementations§
impl Freeze for ObjectId
impl RefUnwindSafe for ObjectId
impl Send for ObjectId
impl Sync for ObjectId
impl Unpin for ObjectId
impl UnsafeUnpin for ObjectId
impl UnwindSafe for ObjectId
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