pub struct ChangeId(/* private fields */);Expand description
An object hash used as stable identifier for a change.
Its bytes are identical to the wrapped ObjectId, but its textual form uses
Jujutsu’s reverse-hex alphabet z through k instead of 0 through f.
Implementations§
Source§impl ChangeId
impl ChangeId
Sourcepub fn from_reverse_hex(buffer: &[u8]) -> Result<Self, Error>
pub fn from_reverse_hex(buffer: &[u8]) -> Result<Self, Error>
Parse a complete SHA-1 or SHA-256 hash written with reverse-hex alphabet.
Sourcepub fn to_reverse_hex(&self) -> ReverseHexDisplay<'_>
pub fn to_reverse_hex(&self) -> ReverseHexDisplay<'_>
Return a type which displays this ID in reverse-hex notation.
Sourcepub fn to_reverse_hex_with_len(&self, len: usize) -> ReverseHexDisplay<'_>
pub fn to_reverse_hex_with_len(&self, len: usize) -> ReverseHexDisplay<'_>
Return a type which displays at most len characters of this ID in reverse-hex notation.
Methods from Deref<Target = oid>§
Sourcepub fn first_byte(&self) -> u8
pub fn first_byte(&self) -> u8
The first byte of the hash, commonly used to partition a set of object ids.
Sourcepub fn to_hex_with_len(&self, len: usize) -> HexDisplay<'_>
pub fn to_hex_with_len(&self, len: usize) -> HexDisplay<'_>
Return a type which can display itself in hexadecimal form with the len amount of characters.
Sourcepub fn to_prefix(&self, range: Range<usize>) -> Prefix
pub fn to_prefix(&self, range: Range<usize>) -> Prefix
Return the bytes in range as a standalone, byte-aligned Prefix.
The range addresses raw hash bytes, not hexadecimal digits. Thus, each selected byte contributes two hexadecimal digits to the returned prefix. The selected bytes become the beginning of the prefix, independently of where they occurred in this object ID.
§Panics
If range is out of bounds or has its start after its end.
Sourcepub fn hex_to_buf<'a>(&self, buf: &'a mut [u8]) -> &'a mut str
pub fn hex_to_buf<'a>(&self, buf: &'a mut [u8]) -> &'a mut str
Write ourselves to the out in hexadecimal notation, returning the hex-string ready for display.
§Panics
If the buffer isn’t big enough to hold twice as many bytes as the current binary size.
Sourcepub fn write_hex_to(&self, out: &mut dyn Write) -> Result<()>
pub fn write_hex_to(&self, out: &mut dyn Write) -> Result<()>
Write ourselves to out in hexadecimal notation.
Sourcepub fn is_empty_blob(&self) -> bool
pub fn is_empty_blob(&self) -> bool
Returns true if this hash is equal to an empty blob.
Sourcepub fn is_empty_tree(&self) -> bool
pub fn is_empty_tree(&self) -> bool
Returns true if this hash is equal to an empty tree.
Trait Implementations§
impl Copy for ChangeId
Source§impl<'de> Deserialize<'de> for ChangeId
Available on crate feature serde only.
impl<'de> Deserialize<'de> for ChangeId
serde only.