Skip to content

std::path

Lexical filesystem-path operations; platform path grammar, no URL parsing or I/O.

API details and source

The implementation source contains the complete declarations and implementation notes. The table below lists canonical Gossamer call signatures; every item name links directly to its implementation file.

Item Canonical signature or declaration Description
Path type Path Immutable UTF-8 lexical path with value-returning operations.
extension fn extension(path: String) -> Option<String> Dotted extension as an Option.
file_name fn file_name(path: String) -> Option<String> Final path component, or None.
file_stem fn file_stem(path: String) -> Option<String> File name without its extension.
is_absolute fn is_absolute(path: String) -> bool Reports whether the path is absolute.
join fn join(base: String, segment: String) -> String Joins two path fragments.
normalize fn normalize(path: String) -> String Lexically normalizes the path.
parent fn parent(path: String) -> Option<String> Parent directory, or None at the root.
split fn split(path: String) -> (String, String) Returns (dir, file) for the supplied path.
starts_with fn starts_with(path: String, prefix: String) -> bool Reports whether the path begins with a prefix component-wise.

Path performs no I/O. Its join, parent, file_name, stem, extension, normalize, is_absolute, and starts_with methods return new values or observations. Keep filesystem access in std::fs so errors and symlink policy stay explicit.