pub struct GroupName(pub PathBuf);Expand description
Helper type for a group’s name
Tuple Fields
0: PathBufImplementations
sourceimpl GroupName
impl GroupName
sourcepub fn main(&self) -> String
pub fn main(&self) -> String
Gets the first component of this name, components are separated by slashes.
sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Checks if this name is empty.
Example
assert!(GroupName("a".into()).validate().is_ok());
assert!(GroupName("a/b/c".into()).validate().is_ok());
assert!(GroupName("/starts/with/slash".into()).validate().is_err());
assert!(GroupName("relative/../path".into()).validate().is_err());sourcepub fn with_subgroup_prefix(&self, subgroup_prefix: &str) -> PathBuf
pub fn with_subgroup_prefix(&self, subgroup_prefix: &str) -> PathBuf
Returns a PathBuf, which adds a subgroup_prefix to each of the
components other than the main component.
Example
let gn = GroupName("gui/gtk".into());
assert_eq!(
gn.with_subgroup_prefix("#"),
PathBuf::from_str("gui/#gtk").unwrap(),
);Trait Implementations
sourceimpl<'de> Deserialize<'de> for GroupName
impl<'de> Deserialize<'de> for GroupName
sourcefn 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>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for GroupName
Auto Trait Implementations
impl RefUnwindSafe for GroupName
impl Send for GroupName
impl Sync for GroupName
impl Unpin for GroupName
impl UnwindSafe for GroupName
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more