pub struct LocalScope { /* private fields */ }Implementations§
Source§impl LocalScope
impl LocalScope
Sourcepub fn new(allowed: &[PathBuf]) -> Self
pub fn new(allowed: &[PathBuf]) -> Self
Roots are canonicalised now so symlinked roots still compare equal to canonicalised requests. A root that does not exist yet is kept as written and simply never matches.
pub fn roots(&self) -> &[PathBuf]
pub fn is_empty(&self) -> bool
Sourcepub fn resolve_existing(&self, raw: &str) -> Result<PathBuf>
pub fn resolve_existing(&self, raw: &str) -> Result<PathBuf>
Resolve a model-supplied path to a canonical path inside a root. Symlinks are followed before the containment check, so a link pointing outside the allowed directories is refused.
Sourcepub fn resolve_for_write(&self, raw: &str) -> Result<PathBuf>
pub fn resolve_for_write(&self, raw: &str) -> Result<PathBuf>
Resolve a path that may not exist yet (a download target). The nearest existing ancestor must be inside a root.
pub fn list(&self, dir: &Path) -> Result<Vec<LocalEntry>>
Auto Trait Implementations§
impl Freeze for LocalScope
impl RefUnwindSafe for LocalScope
impl Send for LocalScope
impl Sync for LocalScope
impl Unpin for LocalScope
impl UnsafeUnpin for LocalScope
impl UnwindSafe for LocalScope
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more