pub struct StorePathNameBuf(SmolStr);Expand description
An owned validated name of a store path.
The name may only contain ASCII alphanumeric, or one of the following
characters: -, _, ., +, ?, = and must be shorter than 211 characters long.
Tuple Fields§
§0: SmolStrImplementations§
Source§impl StorePathNameBuf
impl StorePathNameBuf
Sourcepub fn source() -> StorePathNameBuf
pub fn source() -> StorePathNameBuf
Sourcepub fn from_string(name: String) -> Result<Self, ParseStorePathNameError>
pub fn from_string(name: String) -> Result<Self, ParseStorePathNameError>
Checks a given String to match the restrictions for store path names, and
returns the name as StorePathNameBuf if successful.
Sourcepub fn from_smol_str(name: SmolStr) -> Result<Self, ParseStorePathNameError>
pub fn from_smol_str(name: SmolStr) -> Result<Self, ParseStorePathNameError>
Checks a given SmolStr to match the restrictions for store path names, and
returns the name as StorePathNameBuf if successful.
Sourcepub fn from_slice(name: &[u8]) -> Result<Self, ParseStorePathNameError>
pub fn from_slice(name: &[u8]) -> Result<Self, ParseStorePathNameError>
Checks a given &[u8] to match the restrictions for store path names, and
returns the name as StorePathNameBuf if successful.
Sourcepub fn as_name(&self) -> &StorePathName
pub fn as_name(&self) -> &StorePathName
Coerces to a StorePathName slice.
§Examples
let name = StorePathNameBuf::try_from("snix-build").unwrap();
assert_eq!(StorePathName::from_str("snix-build").unwrap(), name.as_name());Methods from Deref<Target = StorePathName>§
Sourcepub fn build_drv_name(
&self,
) -> Result<StorePathNameBuf, ParseStorePathNameError>
pub fn build_drv_name( &self, ) -> Result<StorePathNameBuf, ParseStorePathNameError>
Build a new StorePathNameBuf by adding .drv extension to this StorePathName. This
fails if this name already ends in .drv or the resulting name would be too long.
§Examples
let n = StorePathName::from_str("snix-eval").unwrap();
assert_eq!(n.build_drv_name().unwrap(), "snix-eval.drv");Sourcepub fn strip_drv_ext(&self) -> Option<&StorePathName>
pub fn strip_drv_ext(&self) -> Option<&StorePathName>
Remove .drv extension from this name or return None if this is not a derivation name.
Sourcepub fn strip_suffix(&self, suffix: &str) -> Option<&StorePathName>
pub fn strip_suffix(&self, suffix: &str) -> Option<&StorePathName>
Strip a suffix from this name or return None if the resulting name would have been empty.
Sourcepub fn as_str(&self) -> &str
pub fn as_str(&self) -> &str
Converts a name to a string. To convert the string back into a name,
use the Self::from_str function.
§Examples
let s = StorePathName::source().as_str();
assert_eq!("source", s);Trait Implementations§
Source§impl AsRef<StorePathName> for StorePathNameBuf
impl AsRef<StorePathName> for StorePathNameBuf
Source§fn as_ref(&self) -> &StorePathName
fn as_ref(&self) -> &StorePathName
Source§impl AsRef<str> for StorePathNameBuf
impl AsRef<str> for StorePathNameBuf
Source§impl Borrow<StorePathName> for StorePathNameBuf
impl Borrow<StorePathName> for StorePathNameBuf
Source§fn borrow(&self) -> &StorePathName
fn borrow(&self) -> &StorePathName
Source§impl Clone for StorePathNameBuf
impl Clone for StorePathNameBuf
Source§fn clone(&self) -> StorePathNameBuf
fn clone(&self) -> StorePathNameBuf
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StorePathNameBuf
impl Debug for StorePathNameBuf
Source§impl Default for StorePathNameBuf
impl Default for StorePathNameBuf
Source§impl Deref for StorePathNameBuf
impl Deref for StorePathNameBuf
Source§impl Display for StorePathNameBuf
impl Display for StorePathNameBuf
Source§impl<'a> From<&'a StorePathName> for StorePathNameBuf
impl<'a> From<&'a StorePathName> for StorePathNameBuf
Source§fn from(value: &'a StorePathName) -> Self
fn from(value: &'a StorePathName) -> Self
Source§impl FromStr for StorePathNameBuf
impl FromStr for StorePathNameBuf
Source§impl Hash for StorePathNameBuf
impl Hash for StorePathNameBuf
Source§impl PartialEq<&StorePathName> for StorePathNameBuf
impl PartialEq<&StorePathName> for StorePathNameBuf
Source§fn eq(&self, other: &&StorePathName) -> bool
fn eq(&self, other: &&StorePathName) -> bool
self and other values to be equal, and is used by ==.Source§impl PartialEq<&str> for StorePathNameBuf
impl PartialEq<&str> for StorePathNameBuf
Source§impl PartialEq<StorePathNameBuf> for &StorePathName
impl PartialEq<StorePathNameBuf> for &StorePathName
Source§fn eq(&self, other: &StorePathNameBuf) -> bool
fn eq(&self, other: &StorePathNameBuf) -> bool
self and other values to be equal, and is used by ==.Source§impl PartialEq<StorePathNameBuf> for &str
impl PartialEq<StorePathNameBuf> for &str
Source§fn eq(&self, other: &StorePathNameBuf) -> bool
fn eq(&self, other: &StorePathNameBuf) -> bool
self and other values to be equal, and is used by ==.Source§impl PartialEq<StorePathNameBuf> for String
impl PartialEq<StorePathNameBuf> for String
Source§fn eq(&self, other: &StorePathNameBuf) -> bool
fn eq(&self, other: &StorePathNameBuf) -> bool
self and other values to be equal, and is used by ==.Source§impl PartialEq<StorePathNameBuf> for str
impl PartialEq<StorePathNameBuf> for str
Source§fn eq(&self, other: &StorePathNameBuf) -> bool
fn eq(&self, other: &StorePathNameBuf) -> bool
self and other values to be equal, and is used by ==.Source§impl PartialEq<String> for StorePathNameBuf
impl PartialEq<String> for StorePathNameBuf
Source§impl PartialEq<str> for StorePathNameBuf
impl PartialEq<str> for StorePathNameBuf
Source§impl PartialEq for StorePathNameBuf
impl PartialEq for StorePathNameBuf
Source§fn eq(&self, other: &StorePathNameBuf) -> bool
fn eq(&self, other: &StorePathNameBuf) -> bool
self and other values to be equal, and is used by ==.Source§impl TryFrom<&[u8]> for StorePathNameBuf
impl TryFrom<&[u8]> for StorePathNameBuf
Source§impl TryFrom<&str> for StorePathNameBuf
impl TryFrom<&str> for StorePathNameBuf
Source§impl TryFrom<SmolStr> for StorePathNameBuf
impl TryFrom<SmolStr> for StorePathNameBuf
Source§impl TryFrom<String> for StorePathNameBuf
impl TryFrom<String> for StorePathNameBuf
impl Eq for StorePathNameBuf
impl StructuralPartialEq for StorePathNameBuf
Auto Trait Implementations§
impl Freeze for StorePathNameBuf
impl RefUnwindSafe for StorePathNameBuf
impl Send for StorePathNameBuf
impl Sync for StorePathNameBuf
impl Unpin for StorePathNameBuf
impl UnsafeUnpin for StorePathNameBuf
impl UnwindSafe for StorePathNameBuf
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> 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.