pub type StorePathRef<'a> = StorePath<&'a str>;
Expand description
Aliased Type§
struct StorePathRef<'a> {
digest: [u8; 20],
name: &'a str,
}
Fields§
§digest: [u8; 20]
§name: &'a str
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<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.