pub struct LocalAbsolutePath { /* private fields */ }Expand description
An absolute, non-root, normalised local path, validated without touching the filesystem.
This is the type Host.runner_root_override and
crate::workspace::WorkspacePolicy::Persistent are written in, so “the
stored value has a legal shape” is a property of the type rather than a check
a caller may forget — the same reasoning crate::model gives for
NonZeroU16 capacity.
The stored text is normalised: separators are the platform’s own, repeated
separators are collapsed, . components are dropped, a trailing separator is
removed, and a Windows drive letter is upper-cased. Two operators who type
c:/rman/ and C:\rman therefore configure one value, which is what makes
the overlap comparisons b1 layers on top meaningful.
Implementations§
Source§impl LocalAbsolutePath
impl LocalAbsolutePath
Sourcepub fn new(raw: impl AsRef<str>) -> Result<Self, LocalPathError>
pub fn new(raw: impl AsRef<str>) -> Result<Self, LocalPathError>
Validate against the platform this build runs on.
This is the entry point for database load, the CLI and the TUI:
02-target-architecture.md requires “an absolute path native to the
current host”, so a Windows path in a database opened on Linux is corrupt
state and fails closed here.
§Errors
Any LocalPathError.
Sourcepub fn parse_for(
raw: impl AsRef<str>,
platform: PathPlatform,
) -> Result<Self, LocalPathError>
pub fn parse_for( raw: impl AsRef<str>, platform: PathPlatform, ) -> Result<Self, LocalPathError>
Sourcepub fn as_path(&self) -> &Path
pub fn as_path(&self) -> &Path
The same value as a Path, for callers that do filesystem work with it
after the operational preflight has passed.
Sourcepub const fn platform(&self) -> PathPlatform
pub const fn platform(&self) -> PathPlatform
Which platform’s rules this value was accepted under.
Sourcepub fn join_child(&self, name: impl AsRef<str>) -> Result<Self, LocalPathError>
pub fn join_child(&self, name: impl AsRef<str>) -> Result<Self, LocalPathError>
A validated child directory of this path, one component down.
Containment is by construction rather than by comparison: the child name
is required to be a single component, so <root>/sN — the slot path
02-target-architecture.md describes — cannot escape the root it was
derived from however the caller spells N. The canonical, symlink-aware
half of that check is b1’s operational preflight; this is the lexical
half.
§Errors
LocalPathError::NotASingleComponent for an empty name, a separator, a
. or a .., plus the platform’s own component rules.
Trait Implementations§
Source§impl Clone for LocalAbsolutePath
impl Clone for LocalAbsolutePath
Source§fn clone(&self) -> LocalAbsolutePath
fn clone(&self) -> LocalAbsolutePath
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more