pub struct PathPattern { /* private fields */ }Expand description
A validated path glob used by a filesystem rule.
Implementations§
Source§impl PathPattern
impl PathPattern
Sourcepub fn absolute(pattern: impl Into<String>) -> Result<Self, PolicyError>
pub fn absolute(pattern: impl Into<String>) -> Result<Self, PolicyError>
Creates a glob rooted at a native absolute path.
Sourcepub fn workspace(pattern: impl Into<String>) -> Result<Self, PolicyError>
pub fn workspace(pattern: impl Into<String>) -> Result<Self, PolicyError>
Creates a glob relative to every workspace root in the context.
Sourcepub const fn is_absolute(&self) -> bool
pub const fn is_absolute(&self) -> bool
Returns whether this pattern is rooted at an absolute path.
Sourcepub fn literal_prefix(&self) -> PathBuf
pub fn literal_prefix(&self) -> PathBuf
Returns the static path prefix before the first glob component.
Absolute patterns return an absolute prefix. Workspace patterns return a relative prefix that must be resolved through the effective runtime workspace roots. An empty workspace prefix means the workspace root; an absolute root-only prefix must be rejected by backends that cannot safely scan the complete filesystem.
Sourcepub fn matches_path(&self, path: &Path, context: &PathResolutionContext) -> bool
pub fn matches_path(&self, path: &Path, context: &PathResolutionContext) -> bool
Tests this pattern against one path in a validated runtime context.
This is pattern matching only, not a filesystem authorization result. Callers enforcing an effective sandbox must still evaluate the complete filesystem policy after expansion.
Trait Implementations§
Source§impl Clone for PathPattern
impl Clone for PathPattern
Source§fn clone(&self) -> PathPattern
fn clone(&self) -> PathPattern
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more