std/path
Path: a root and a list of components, and never a string. joined cannot be given a root, parent cannot
fall off the top, .. is only resolved on purpose, and show() is the one text form every platform agrees on.
std/path is pure value arithmetic over text. It reads no disk and touches no file system - std/fs is where a
Path meets the operating system, and where the capability to read or write one lives.
Modules
std/path/error[PathError], what [Path.resolved] refuses and why.std/path/path[Path], a root plus the components between its separators - never a string - and [Path.from], the infallible parse that builds one out of text.std/path/root[Root], the four things a path can start at - nothing, the file system, a drive or a share - and the text each of them shows as.
Everything
- type
PathA file path: where it starts, and the components between the separators. - extend
Path with From<String>A path is what the text says it is. - type
PathErrorWhat a path operation refuses. - type
RootWhere a path starts. - extend
String with From<Path>The way back out of [Path], and with [Path.from] it is the conversion pair of the capsule:PathhasFrom<String>andStringhasFrom<Path>, so the derivedEncodewrites a path as its text and the derivedDecodereads a text and hands it to [Path.from].