pub struct GroupName(pub PathBuf);Expand description
Helper type for a group’s name
Tuple Fields§
§0: PathBufImplementations§
Source§impl 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§
Source§impl<'de> Deserialize<'de> for GroupName
impl<'de> Deserialize<'de> for GroupName
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>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for GroupName
Auto Trait Implementations§
impl Freeze for GroupName
impl RefUnwindSafe for GroupName
impl Send for GroupName
impl Sync for GroupName
impl Unpin for GroupName
impl UnwindSafe for GroupName
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
Mutably borrows from an owned value. Read more