pub struct PathSelector { /* private fields */ }Expand description
A platform-independent description of a filesystem scope.
Implementations§
Source§impl PathSelector
impl PathSelector
Sourcepub fn absolute(path: impl Into<PathBuf>) -> Result<Self, PolicyError>
pub fn absolute(path: impl Into<PathBuf>) -> Result<Self, PolicyError>
Creates an absolute selector without touching the filesystem.
Sourcepub fn workspace_root() -> Self
pub fn workspace_root() -> Self
Creates a selector for the workspace root itself.
Sourcepub const fn root() -> Self
pub const fn root() -> Self
Creates a selector for every system root supplied by the runtime.
The selector is symbolic. A backend must populate
PathResolutionContext::with_root for the target platform.
Sourcepub fn workspace(relative: impl Into<PathBuf>) -> Result<Self, PolicyError>
pub fn workspace(relative: impl Into<PathBuf>) -> Result<Self, PolicyError>
Creates a selector relative to every workspace root.
Sourcepub fn resolve(&self, context: &PathResolutionContext) -> Vec<PathBuf>
pub fn resolve(&self, context: &PathResolutionContext) -> Vec<PathBuf>
Resolves this selector against a caller-provided runtime context.
Sourcepub fn path(&self) -> Option<&Path>
pub fn path(&self) -> Option<&Path>
Returns the stored path for an absolute or workspace-relative selector.
Sourcepub const fn is_special(&self) -> bool
pub const fn is_special(&self) -> bool
Returns whether this selector is a special platform-defined scope.
Sourcepub const fn is_workspace_scope(&self) -> bool
pub const fn is_workspace_scope(&self) -> bool
Returns whether this selector resolves relative to runtime workspace roots.
Sourcepub const fn is_root_scope(&self) -> bool
pub const fn is_root_scope(&self) -> bool
Returns whether this selector targets caller-supplied system roots.
Sourcepub const fn is_minimal_scope(&self) -> bool
pub const fn is_minimal_scope(&self) -> bool
Returns whether this selector targets the platform-minimal scope.
Sourcepub const fn is_tmpdir_scope(&self) -> bool
pub const fn is_tmpdir_scope(&self) -> bool
Returns whether this selector targets the platform temporary directory.
Sourcepub const fn is_slash_tmp_scope(&self) -> bool
pub const fn is_slash_tmp_scope(&self) -> bool
Returns whether this selector targets the conventional /tmp scope.
Sourcepub const fn is_absolute_scope(&self) -> bool
pub const fn is_absolute_scope(&self) -> bool
Returns whether this selector stores a native absolute path.
Trait Implementations§
Source§impl Clone for PathSelector
impl Clone for PathSelector
Source§fn clone(&self) -> PathSelector
fn clone(&self) -> PathSelector
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more