docs.rs failed to build path-lib-1.0.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Features
Application Directories
- Eight kinds — data, config, cache, logs, state, runtime, temp, documents
- Three scopes —
App::new(this user),App::global(the machine),App::portable(one folder you choose) - Portable detection —
App::autoswitches to a portable layout when a.portablefile sits next to the executable - Overrides —
with_dirrelocates one kind;with_env("HIVEDB")readsHIVEDB_DATA_DIR,HIVEDB_LOGS_DIR, and so on - Native conventions — XDG and FHS on Linux and BSD, the
Librarydomains on macOS, Known Folders on Windows - Distinct by construction — no two kinds share a directory, so clearing the cache can never wipe data; overrides are checked too
Hardened Sub-Paths
- Either slash style —
"a/b","a\\b","/a//b/"all mean the same thing and produce the platform separator - Reject, don't repair — traversal, absolute paths, reserved names and characters fail before any path is built
sanitize— lossy repair for user-supplied names; its output is always accepted
OS Folders
home,documents,desktop,downloads,pictures,music,videos— redirect-awareroot,temp,exe,exe_dir— plusos(), a compile-time constantexpand_home—~and~/restfor paths read from configuration;$VARSare deliberately left alone- Resolved once — cached for the life of the process; later calls cost about a nanosecond
Guarded File Operations
make_dir,make_file,exists,list,remove,copy,move_to,find- Never overwrites, never follows links, refuses catastrophic deletes
- Atomic copies — staged under a temporary name, renamed into place when complete
write_atomic— replaces a file through a flushed temporary and a rename; keeps Unix permissions and symbolic links
Installation
[]
= "1.0"
Quick Start
use ;
// Per-user directories, relocatable with HIVEDB_DATA_DIR and friends.
let app = new?.with_env?;
// Base directories, resolved once.
println!; // ~/Library/Application Support/HiveDB on macOS
// Hardened sub-paths: any slash style, always inside the base.
let db = app.data_at?;
assert!;
// Create on demand (0700 on Unix for user scope).
let wal = app.create?;
// Replace a file atomically: readers see the old or the new contents.
write_atomic?;
// Machine-wide, for services.
let svc = global?;
println!; // /etc/HiveDB on Linux
# Ok::
Where Things Go
| Kind | Linux (user) | macOS (user) | Windows (user) |
|---|---|---|---|
| data | ~/.local/share/<app> |
~/Library/Application Support/<app> |
%LOCALAPPDATA%\<app> |
| config | ~/.config/<app> |
~/Library/Preferences/<app> |
%APPDATA%\<app> |
| cache | ~/.cache/<app> |
~/Library/Caches/<app> |
%LOCALAPPDATA%\<app>\cache |
| logs | ~/.local/state/<app>/logs |
~/Library/Logs/<app> |
%LOCALAPPDATA%\<app>\logs |
| Kind | Linux (global) | macOS (global) | Windows (global) |
|---|---|---|---|
| data | /var/lib/<app> |
/Library/Application Support/<app> |
%ProgramData%\<app> |
| config | /etc/<app> |
/Library/Preferences/<app> |
%ProgramData%\<app>\config |
| cache | /var/cache/<app> |
/Library/Caches/<app> |
%ProgramData%\<app>\cache |
| logs | /var/log/<app> |
/Library/Logs/<app> |
%ProgramData%\<app>\logs |
The full tables, including state, runtime, temp, and documents, are in the API reference.
User Input
let app = new?;
// Reject: for paths your code builds.
let p = app.documents_at?;
// Repair: for names a user typed.
let name = sanitize; // "Q3_ final_.pdf"
let p = app.documents_at?;
# Ok::
Documentation
- API reference — every public item, the directory tables, and the validation rules.
- Stability contract — what 1.x guarantees and what may still change.
- Performance — benchmark methodology and results.
- Developer guidelines — the engineering bar this project is built to.
- Release notes — what shipped, when, and why.
Contributing
Contributions are welcome under the project's dual license. Before opening a pull request, please make sure:
cargo fmt --all -- --checkpasses.cargo clippy --all-targets --all-features -- -D warningsis clean.cargo test --all-featurespasses.- New public items include documentation and at least one example.
- The API reference and CHANGELOG are updated alongside code changes.