pub fn is_type_valid(ty: &str) -> bool {
let first = match ty.chars().next() {
Some(c) => c,
None => return false,
};
if first.is_ascii_digit() {
return false;
}
#[allow(clippy::match_like_matches_macro)]
ty.chars().all(|c| match c {
'.' | '-' | '+' | 'a'..='z' | 'A'..='Z' | '0'..='9' => true,
_ => false,
})
}
pub fn is_qualifier_key_valid(key: &str) -> bool {
let first = match key.chars().next() {
Some(c) => c,
None => return false,
};
if first.is_ascii_digit() {
return false;
}
#[allow(clippy::match_like_matches_macro)]
key.chars().all(|c| match c {
'.' | '-' | '_' | 'a'..='z' | 'A'..='Z' | '0'..='9' => true,
_ => false,
})
}
pub fn is_namespace_component_valid(component: &str) -> bool {
!component.is_empty() && !component.chars().any(|c| c == '/')
}
pub fn is_subpath_segment_valid(segment: &str) -> bool {
!segment.is_empty() && segment != "." && segment != ".." && !segment.chars().any(|c| c == '/')
}