pub struct StorePath {
digest: [u8; 20],
name: SmolStr,
}Expand description
Represents a path in the Nix store (a direct child of STORE_DIR).
It consists of a digest (20 bytes), and a name, which is a string.
The name may only contain ASCII alphanumeric, or one of the following
characters: -, _, ., +, ?, =.
The name is usually used to describe the pname and version of a package.
Derivation paths can also be represented as store paths, their names just
end with the .drv prefix.
A StorePath does not encode any additional subpath “inside” the store path.
Fields§
§digest: [u8; 20]§name: SmolStrImplementations§
Source§impl StorePath
impl StorePath
pub fn digest(&self) -> &[u8; 20]
pub fn name(&self) -> &str
Sourcepub fn from_bytes(s: &[u8]) -> Result<Self, ParseStorePathError>
pub fn from_bytes(s: &[u8]) -> Result<Self, ParseStorePathError>
Construct a StorePath by passing the $digest-$name string
that comes after STORE_DIR_WITH_SLASH.
Sourcepub fn from_name_and_digest(
name: &str,
digest: &[u8],
) -> Result<Self, ParseStorePathError>
pub fn from_name_and_digest( name: &str, digest: &[u8], ) -> Result<Self, ParseStorePathError>
Construct a StorePath from a name and digest. The name is validated, and the digest checked for size.
Sourcepub fn from_name_and_digest_fixed(
name: &str,
digest: [u8; 20],
) -> Result<Self, ParseStorePathError>
pub fn from_name_and_digest_fixed( name: &str, digest: [u8; 20], ) -> Result<Self, ParseStorePathError>
Construct a StorePathRef from a name and digest of correct length. The name is validated.
Sourcepub fn from_absolute_path(s: &[u8]) -> Result<Self, ParseStorePathError>
pub fn from_absolute_path(s: &[u8]) -> Result<Self, ParseStorePathError>
Construct a StorePathRef from an absolute store path string. This is equivalent to calling StorePathRef::from_bytes, but stripping the STORE_DIR_WITH_SLASH prefix before.
Sourcepub fn from_absolute_path_full<P>(
path: &P,
) -> Result<(Self, &Path), ParseStorePathError>
pub fn from_absolute_path_full<P>( path: &P, ) -> Result<(Self, &Path), ParseStorePathError>
Decompose a string into a StorePathRef and a std::path::Path containing the rest of the path, or an error.
Sourcepub fn to_absolute_path(&self) -> String
pub fn to_absolute_path(&self) -> String
Returns as an absolute store path (prefixed with STORE_DIR_WITH_SLASH).
Sourcepub fn as_absolute_path_fmt<'a>(&'a self) -> impl Display + 'a
pub fn as_absolute_path_fmt<'a>(&'a self) -> impl Display + 'a
Returns a formatter writing an absolute store path (prefixed with STORE_DIR_WITH_SLASH).
Trait Implementations§
Source§impl AtermWriteable for &StorePath
impl AtermWriteable for &StorePath
Source§impl<'de> Deserialize<'de> for StorePath
Available on crate feature serde only.
impl<'de> Deserialize<'de> for StorePath
serde only.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>,
Source§impl Equivalent<StorePath> for StorePathRef<'_>
Available on crate feature hashbrown only.
impl Equivalent<StorePath> for StorePathRef<'_>
hashbrown only.Source§fn equivalent(&self, key: &StorePath) -> bool
fn equivalent(&self, key: &StorePath) -> bool
key and return true if they are equal.Source§impl<'a> From<StorePathRef<'a>> for StorePath
impl<'a> From<StorePathRef<'a>> for StorePath
Source§fn from(value: StorePathRef<'a>) -> Self
fn from(value: StorePathRef<'a>) -> Self
Source§impl NixDeserialize for StorePath
Available on crate features wire and nix-compat-derive only.
impl NixDeserialize for StorePath
wire and nix-compat-derive only.Source§impl NixSerialize for StorePath
Available on crate features wire and nix-compat-derive only.
impl NixSerialize for StorePath
wire and nix-compat-derive only.Source§impl Ord for StorePath
StorePaths are sorted by their reverse digest to match the sorting order
of the nixbase32-encoded string.
impl Ord for StorePath
StorePaths are sorted by their reverse digest to match the sorting order
of the nixbase32-encoded string.
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for StorePath
impl PartialOrd for StorePath
impl Eq for StorePath
impl StructuralPartialEq for StorePath
Auto Trait Implementations§
impl Freeze for StorePath
impl RefUnwindSafe for StorePath
impl Send for StorePath
impl Sync for StorePath
impl Unpin for StorePath
impl UnsafeUnpin for StorePath
impl UnwindSafe for StorePath
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
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
key and return true if they are equal.