pub enum SegmentedPathName<'a> {
Single(SafePathSegment<'a>),
Prefixed(SafePathSegment<'a>, SafePathSegment<'a>),
}Expand description
One or two validated path segments for a fetch URL built from a package name.
Covers both a bare identifier and a <prefix>/<name>-shaped one — the split shape shared
by npm’s @scope/pkg and Composer’s vendor/package registry-fetch URLs.
Each ecosystem keeps its own parsing (npm strips a leading @ before splitting; Composer
splits on the first / with no scope marker), so this type carries only the already-split,
already-validated result — never the splitting logic itself.
§Examples
use deps_core::path_segment::{SafePathSegment, SegmentedPathName};
let bare = SegmentedPathName::Single(SafePathSegment::new("left-pad").unwrap());
let prefixed = SegmentedPathName::Prefixed(
SafePathSegment::new("monolog").unwrap(),
SafePathSegment::new("monolog").unwrap(),
);
assert!(matches!(bare, SegmentedPathName::Single(_)));
assert!(matches!(prefixed, SegmentedPathName::Prefixed(_, _)));Variants§
Single(SafePathSegment<'a>)
A single, unprefixed path segment (Composer’s fallback bare form, npm’s unscoped name).
Prefixed(SafePathSegment<'a>, SafePathSegment<'a>)
A <prefix>/<name> pair, each independently validated (npm’s @scope/pkg,
Composer’s vendor/package).
Trait Implementations§
Source§impl<'a> Clone for SegmentedPathName<'a>
impl<'a> Clone for SegmentedPathName<'a>
impl<'a> Copy for SegmentedPathName<'a>
Source§impl<'a> Debug for SegmentedPathName<'a>
impl<'a> Debug for SegmentedPathName<'a>
impl<'a> Eq for SegmentedPathName<'a>
Source§impl<'a> Hash for SegmentedPathName<'a>
impl<'a> Hash for SegmentedPathName<'a>
Source§impl<'a> PartialEq for SegmentedPathName<'a>
impl<'a> PartialEq for SegmentedPathName<'a>
impl<'a> StructuralPartialEq for SegmentedPathName<'a>
Auto Trait Implementations§
impl<'a> Freeze for SegmentedPathName<'a>
impl<'a> RefUnwindSafe for SegmentedPathName<'a>
impl<'a> Send for SegmentedPathName<'a>
impl<'a> Sync for SegmentedPathName<'a>
impl<'a> Unpin for SegmentedPathName<'a>
impl<'a> UnsafeUnpin for SegmentedPathName<'a>
impl<'a> UnwindSafe for SegmentedPathName<'a>
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
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§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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
Compare self to
key and return true if they are equal.