Struct nix_compat::store_path::StorePath
source · pub struct StorePath<S> {
digest: [u8; 20],
name: S,
}
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: S
Implementations§
source§impl<S> StorePath<S>
impl<S> StorePath<S>
pub fn digest(&self) -> &[u8; 20]
pub fn name(&self) -> &S
pub fn as_ref(&self) -> StorePathRef<'_>
pub fn to_owned(&self) -> StorePath<String>
sourcepub fn from_bytes<'a>(s: &'a [u8]) -> Result<Self, Error>
pub fn from_bytes<'a>(s: &'a [u8]) -> Result<Self, Error>
Construct a StorePath by passing the $digest-$name
string
that comes after STORE_DIR_WITH_SLASH.
sourcepub fn from_name_and_digest<'a>(
name: &'a str,
digest: &[u8],
) -> Result<Self, Error>
pub fn from_name_and_digest<'a>( name: &'a str, digest: &[u8], ) -> Result<Self, Error>
Construct a StorePathRef from a name and digest. The name is validated, and the digest checked for size.
sourcepub fn from_name_and_digest_fixed<'a>(
name: &'a str,
digest: [u8; 20],
) -> Result<Self, Error>
pub fn from_name_and_digest_fixed<'a>( name: &'a str, digest: [u8; 20], ) -> Result<Self, Error>
Construct a StorePathRef from a name and digest of correct length. The name is validated.
sourcepub fn from_absolute_path<'a>(s: &'a [u8]) -> Result<Self, Error>
pub fn from_absolute_path<'a>(s: &'a [u8]) -> Result<Self, Error>
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<'a, P>(
path: &'a P,
) -> Result<(Self, &'a Path), Error>
pub fn from_absolute_path_full<'a, P>( path: &'a P, ) -> Result<(Self, &'a Path), Error>
Decompose a string into a StorePath and a [PathBuf] containing the rest of the path, or an error.
sourcepub fn to_absolute_path(&self) -> String
pub fn to_absolute_path(&self) -> String
Returns an absolute store path string. That is just the string representation, prefixed with the store prefix (STORE_DIR_WITH_SLASH),
Trait Implementations§
source§impl<S> AtermWriteable for StorePath<S>
impl<S> AtermWriteable for StorePath<S>
source§impl<'a, 'de: 'a, S> Deserialize<'de> for StorePath<S>
impl<'a, 'de: 'a, S> Deserialize<'de> for StorePath<S>
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 NixDeserialize for StorePath<String>
impl NixDeserialize for StorePath<String>
source§impl<S> NixSerialize for StorePath<S>
impl<S> NixSerialize for StorePath<S>
source§impl<S> Ord for StorePath<S>
impl<S> Ord for StorePath<S>
StorePath
s are sorted by their reverse digest to match the sorting order
of the nixbase32-encoded string.
source§impl<S> PartialEq for StorePath<S>
impl<S> PartialEq for StorePath<S>
source§impl<S> PartialOrd for StorePath<S>
impl<S> PartialOrd for StorePath<S>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moreimpl<S> Eq for StorePath<S>
Auto Trait Implementations§
impl<S> Freeze for StorePath<S>where
S: Freeze,
impl<S> RefUnwindSafe for StorePath<S>where
S: RefUnwindSafe,
impl<S> Send for StorePath<S>where
S: Send,
impl<S> Sync for StorePath<S>where
S: Sync,
impl<S> Unpin for StorePath<S>where
S: Unpin,
impl<S> UnwindSafe for StorePath<S>where
S: UnwindSafe,
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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)