Union Pathpub
Source:union(pub) Path
| UnixPath (Vec U8)
| WindowsPath (Vec U16)
Description
Path MUST be an internal union of OS-native byte representations. On Unix targets the UnixPath variant is populated with a sequence of 8-bit bytes; on Windows targets WindowsPath carries 16-bit code units. The concrete variant is selected per target at compile time. Paths are NOT guaranteed to be valid UTF-8.
Variants
Implementations
impl Path
.components ( Path → (Vec Component) )
.components ( Path → (Vec Component) )
.components — decompose the path into its left-to-right sequence of Component values. RootDir appears first (and only first) when the path is absolute. . / .. fragments surface as CurDir / ParentDir and are NOT resolved (that is .canonicalize's job).
.extension ( Path → (Option PathSegment) )
.extension ( Path → (Option PathSegment) )
.extension — file extension (portion of last segment after the final .). None if no ., . is first char, or no segments.
.file-name ( Path → (Option PathSegment) )
.file-name ( Path → (Option PathSegment) )
.file-name — last segment as (Option PathSegment); None if the path has no segments.
.from-str ( Str → Path )
.from-str ( Str → Path )
.from-str — parse a Str into a Path. Leading / marks absolute; consecutive / collapse; trailing / is dropped. Qualified dispatch: "/home/user" (Path .from-str).
.parent ( Path → (Option Path) )
.parent ( Path → (Option Path) )
.parent — path with last segment removed, or None if already at root. Single-segment paths yield / (absolute) or . (relative).
.segments ( Path → (Vec PathSegment) )
.segments ( Path → (Vec PathSegment) )
.segments — the sequence of PathSegment values after parsing, excluding any leading root marker.
.stem ( Path → (Option PathSegment) )
.stem ( Path → (Option PathSegment) )
.stem — last segment with its extension stripped. None iff the path has no segments.