Skip to main content

Crate use_path

Crate use_path 

Source
Expand description

§use-path

Practical path utility primitives for RustUse.

§Experimental

use-path is experimental while the use-fs workspace remains below 0.3.0.

§Example

use use_path::{PathKind, normalize_path_separators, path_kind};

assert_eq!(path_kind("C:/Users/example"), PathKind::Absolute);
assert_eq!(normalize_path_separators(r"src\lib.rs"), "src/lib.rs");

§Scope

  • lexical path classification
  • separator detection and normalization
  • simple path joining and splitting
  • parent, file-name, and extension extraction

§Non-goals

  • filesystem access
  • canonicalization against the live filesystem
  • shell expansion
  • symlink resolution

§License

Licensed under either of the following, at your option:

  • Apache License, Version 2.0
  • MIT license

Structs§

PathParts
A lexical view of a path-like input.

Enums§

PathKind
Classifies a path-like input using a small lexical model.
PathSeparator
Describes which separator styles appear in a path-like input.

Functions§

detect_path_separator
Detects which path separator style appears in the input.
ensure_trailing_separator
Ensures a trailing / for non-empty input.
extension_from_path
Extracts the final simple extension from a path-like input.
file_name_from_path
Extracts the final file-name segment from a path-like input.
is_absolute_path
Returns true when the input begins with a recognized absolute prefix.
is_empty_path
Returns true when the input is empty.
is_relative_path
Returns true when the input is non-empty and not absolute.
join_path_parts
Joins path parts with / while preserving a leading absolute prefix when present.
normalize_path_separators
Normalizes path separators to /.
parent_path
Extracts the lexical parent path when one is present.
path_kind
Returns the lexical kind for a path-like input.
path_parts
Returns lexical directory, file-name, and extension parts.
split_path_parts
Splits a path-like input into normalized non-empty segments.
trim_trailing_separator
Removes trailing separators while preserving recognized roots.