no_std_path 0.1.0

A no_std fork of the path module from https://github.com/rust-lang/rust
Documentation
  • Coverage
  • 100%
    3 out of 3 items documented0 out of 0 items with examples
  • Size
  • Source code size: 123.06 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 14.3 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 18s Average build duration of successful builds.
  • all releases: 18s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • atom-planet-embrace/no_std_path
    0 0 1
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • mspiegel

no_std_path

A no_std fork of Rust's std::path module, providing cross-platform path manipulation without the standard library.

Overview

no_std_path provides Path, PathBuf, OsStr, OsString, and the full suite of component/iterator types (Components, Ancestors, Prefix, etc.) adapted from the Rust standard library. It supports parsing, joining, decomposing, and comparing paths on both Unix and Windows.

Most of the code is derived from the Rust standard library with modifications to remove std dependencies.

Features

Feature Default Description
std Yes Re-exports types directly from std::path and std::ffi, giving full platform support and filesystem methods.

When std is disabled, lightweight custom implementations are provided using only core and alloc. This mode is suitable for embedded and no_std targets such as thumbv7m-none-eabi.

Usage

With the std feature (default):

[dependencies]
no_std_path = "0.1"

For no_std environments:

[dependencies]
no_std_path = { version = "0.1", default-features = false }

Example

use no_std_path::{Path, PathBuf};

let path = Path::new("/home/user/file.txt");
assert_eq!(path.file_name().unwrap().to_str(), Some("file.txt"));
assert_eq!(path.extension().unwrap().to_str(), Some("txt"));

let mut buf = PathBuf::from("/home/user");
buf.push("docs");
buf.push("readme.md");
assert_eq!(buf.as_path(), Path::new("/home/user/docs/readme.md"));

Differences from std::path

In no_std mode (with std feature disabled):

  • No filesystem methods — Methods like exists(), canonicalize(), metadata(), read_link(), is_file(), and is_dir() are not available since they require OS interaction.
  • OsStr / OsString are [u8] / Vec<u8> wrappers — The standard library's platform-encoded OS strings are replaced with simple byte-slice newtypes. This means all paths are treated as byte sequences (matching Unix semantics) rather than using platform-specific encoding.

When the std feature is enabled, all types are re-exported from std::path and std::ffi directly, so behavior is identical to the standard library.

Minimum Supported Rust Version

This crate uses Rust edition 2024.

License

Licensed under either of

at your option.

Most code is derived from the Rust standard library, which is also dual-licensed under MIT and Apache 2.0.