Expand description
Small formatting/parsing helpers shared by the other modules.
Structs§
- File
Lock - Advisory exclusive lock on a file. Held for the lifetime of the value.
Constants§
Functions§
- check_
regular_ chain - Check that
base/relis a chain of real directories ending in a regular file, with no symlink at any component. Read-only; used before hashing or restoring a store file. - command_
for - A
Commandfor a trusted tool (cargo,rustc) or a user program: relative names are resolved throughtool_pathto an absolute path. - copy_
file_ hashed - Copy a regular file into a new destination (
O_EXCL) while hashing it. Refuses symlinks/FIFOs/devices and never follows a destination symlink. Returns (bytes, sha256). - copy_
file_ verified - Copy + verify a recorded size/hash. On mismatch the new destination is removed and the operation fails (never installs unverified bytes).
- create_
dir_ chain_ nofollow - Create a directory chain under an existing
basewithout following any symlink component.relmust already have been validated (only normal components). New components are 0700. - create_
private_ dir_ all - Create a directory tree with mode 0700 (Unix), refusing a symlinked or foreign-owned final directory. Existing directories are tightened to 0700.
- dim
- Dimmed — labels, legends, secondary detail.
- ensure_
private_ dir - Verify (and, when possible, repair) an existing private directory.
- error_
block - One failure rendered in the tool’s visual language: a red
✕line, the message’s own continuation lines indented beneath it, then anyanyhowcauses as dim rows. Plain glyphs when colors are off. - euid
- Effective uid. Only meaningful on Unix; 0 elsewhere (permission checks are skipped there and documented as such).
- fail
- Red — failures.
- force_
remove_ dir - Remove a tree robustly: read-only files (a wrapper’s store, copies that
inherited the read-only attribute) block
remove_dir_allon Windows, so clear the flag and retry once; report the original error if it still fails. - green
- Brand-green text (
#92D293) — section titles and success accents. - heading
- Bold brand green — top-level headings.
- human_
age - Age of a timestamp, human-readable (“3.4 days”).
- human_
bytes 1234567->"1.2 MiB"style, compact.- human_
duration - Compact duration for humans (“3.4 s”, “1.2 min”, “2.1 h”).
- info
- Calm blue — neutral info.
- on_path
- Is
programreachable throughPATH? (barewhich, no extra crate) - owned_
by_ us - Is this file owned by the current effective user? (always true off Unix)
- parse_
duration - Parse
"30d","2w","12h","90m","45s"or plain seconds"45". - read_
small_ text - Read a small regular file without following a symlink and without blocking on FIFOs/devices. Returns an error on non-regular or oversized inputs.
- read_
small_ text_ follow - Like
read_small_textbut follows a user’s config symlink (dotfiles); still refuses FIFOs/devices and oversized inputs. - sha256_
file - SHA-256 of a regular file (lowercase hex). Callers that accept untrusted
paths must reject symlinks with
symlink_metadatafirst. - tool_
path - Resolve an executable to an absolute path. This is the Windows
CWD-search fix:
Command::new("cargo")must never be used directly. - validate_
component - One path component: no separators, no
./.., no NUL, no Windows drive/ADS separator. Use for manifest fields that must be one directory or file name (name,profile,memo, parity keys). - validate_
rel - A relative path with only normal components. Rejects absolute paths,
..,., NUL, drive prefixes, and backslash/forward-slash tricks. This is the single gate for every manifest path that reaches the filesystem. - warn
- Amber — warnings.
- which
- Is
programinstalled at all (PATH or cargo bin dir)? - which_
path - Absolute path of
programif discoverable — first onPATH, then as a fallback in Cargo’s own bin dir ($CARGO_HOME/bin, e.g.C:\Users\<user>\.cargo\bin), which rustup tools live in but isn’t on PATH in every shell. ReturnsNonewhen not found anywhere.