#[non_exhaustive]pub enum Durability {
Durable,
NotDurable,
Unknown,
}Expand description
Whether a path string keeps pointing at the same (logical) target across rebuild / upgrade / reboot.
This is a durable-to-pin judgement: a Durable
path may be baked into a launchd plist / systemd unit and is expected to
survive upgrades and reboots. Judgement is per candidate — for the same
binary, the reference path (/opt/homebrew/bin/git) can be
Durable while its canonical realpath
(/opt/homebrew/Cellar/git/2.44.0/bin/git) is
NotDurable.
§Judging model (allow-list)
NotDurableis decided first: versioned-install / ephemeral / build-output / project-local patterns.- Otherwise, if the path is under a known durable location (the
“environment-wide reference surfaces”: standard system bins, profile
bins matched by their exact structure, and shims at standard
HOME-anchored locations), it is
Durable. - Otherwise
Unknown(treated as not-durable byCandidate::is_stable).
User dropbox directories (~/bin, ~/.local/bin) are deliberately not
in the durable allow-list: they mix shebang-embedded scripts and versioned
symlinks, so they fall through to Unknown.
§Known limitations
Judgement is path-string based and cannot detect:
- shebang-embedded versioned dependencies: e.g. a script in a standard
reference surface whose shebang points at a versioned interpreter
(
cpython@<ver>). Such a path may be judgedDurableyet break on upgrade. This is why shebang-prone user dropboxes are excluded from the allow-list (see above), but the case cannot be ruled out entirely. - environment-dependent paths: e.g.
~/.nix-profileis alive in some environments and dead in others; durability cannot be confirmed without inspecting the realpath. - non-UTF-8 paths: pattern matching goes through
Path::to_string_lossy, so a path containing non-UTF-8 bytes in a matched segment may compare unexpectedly; such paths typically fall through toUnknown(safe side).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Durable
The path string keeps pointing at the same entity (or same logical target) across rebuild / upgrade / reboot.
NotDurable
Versioned-install / ephemeral / build-output / project-local etc.; baking this path into a service definition can break it.
Unknown
Matched neither a known durable nor a known not-durable pattern; cannot decide (safe side = treated as not-durable).
Trait Implementations§
Source§impl Clone for Durability
impl Clone for Durability
Source§fn clone(&self) -> Durability
fn clone(&self) -> Durability
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for Durability
Source§impl Debug for Durability
impl Debug for Durability
impl Eq for Durability
Source§impl PartialEq for Durability
impl PartialEq for Durability
Source§fn eq(&self, other: &Durability) -> bool
fn eq(&self, other: &Durability) -> bool
self and other values to be equal, and is used by ==.