neco-pathrel 0.1.1

Policy-driven path relation and rename remap helpers for workspace runtimes
Documentation
  • Coverage
  • 46.15%
    6 out of 13 items documented0 out of 8 items with examples
  • Size
  • Source code size: 14.83 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.86 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 12s Average build duration of successful builds.
  • all releases: 27s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • barineco/neco-editor
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • barineco

neco-pathrel

日本語

String-based path relation helpers for checking subtree membership and rewriting paths through file or directory renames.

Path handling

neco-pathrel compares path strings under an explicit PathPolicy instead of consulting the filesystem. Callers choose the separator and case-sensitivity once, then reuse the same policy for subtree checks, parent lookup, path joining, and rename remapping.

The crate does not canonicalize ., .., symlinks, drive letters, or UNC paths. It stays at the level of runtime path strings so behavior stays deterministic across hosts.

Usage

use neco_pathrel::{path_matches_or_contains, remap_path_for_rename, PathPolicy};

let policy = PathPolicy::posix();

assert!(path_matches_or_contains(
    "/workspace/src/lib.rs",
    "/workspace/src",
    &policy,
));

let renamed = remap_path_for_rename(
    "/workspace/src/lib.rs",
    "/workspace/src",
    "/workspace/core",
    &policy,
);
assert_eq!(renamed.as_deref(), Some("/workspace/core/lib.rs"));

API

Item Description
PathPolicy::new(separator, case_sensitivity) Construct an explicit path comparison policy
PathPolicy::posix() Construct the default POSIX-like policy
path_matches_or_contains(path, target, policy) Return whether path equals target or lies under target
parent_path(path, policy) Return the direct parent slice when one exists
join_path(base, name, policy) Join two path fragments with one separator
remap_path_for_rename(path, source, target, policy) Rewrite one path through a file or subtree rename

License

MIT