pub enum CAHash {
Flat(NixHash),
Nar(NixHash),
Text([u8; 32]),
}Expand description
A Nix CAHash describes a content-addressed hash of a path.
The way Nix prints it as a string is a bit confusing, but there’s essentially
three modes, Flat, Nar and Text.
Flat and Nar support all 4 algos that NixHash supports
(sha1, md5, sha256, sha512), Text only supports sha256.
Variants§
Implementations§
Source§impl CAHash
impl CAHash
pub fn hash(&self) -> Cow<'_, NixHash>
pub fn mode(&self) -> HashMode
Sourcepub fn from_nix_hex_str(s: &str) -> Option<Self>
pub fn from_nix_hex_str(s: &str) -> Option<Self>
Constructs a CAHash from the textual representation, which is one of the three:
text:sha256:$nixbase32sha256digestfixed:r:$algo:$nixbase32digestfixed:$algo:$nixbase32digest
These formats are used in NARInfo, for example.
Trait Implementations§
Source§impl Display for CAHash
Formats a CAHash in the Nix default hash format, which is the format
that’s used in NARInfos for example.
impl Display for CAHash
Formats a CAHash in the Nix default hash format, which is the format that’s used in NARInfos for example.
Source§impl NixDeserialize for CAHash
Available on crate features wire and nix-compat-derive only.
impl NixDeserialize for CAHash
Available on crate features
wire and nix-compat-derive only.Source§impl NixSerialize for CAHash
Available on crate features wire and nix-compat-derive only.
impl NixSerialize for CAHash
Available on crate features
wire and nix-compat-derive only.impl Eq for CAHash
impl StructuralPartialEq for CAHash
Auto Trait Implementations§
impl Freeze for CAHash
impl RefUnwindSafe for CAHash
impl Send for CAHash
impl Sync for CAHash
impl Unpin for CAHash
impl UnsafeUnpin for CAHash
impl UnwindSafe for CAHash
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.