pub struct ApprovedRoot { /* private fields */ }Expand description
An existing directory approved as the boundary for artifact writes.
Implementations§
Source§impl ApprovedRoot
impl ApprovedRoot
Sourcepub fn existing(path: impl AsRef<Path>) -> Result<Self, ArtifactPathError>
pub fn existing(path: impl AsRef<Path>) -> Result<Self, ArtifactPathError>
Approve an existing, non-symlink directory and retain its canonical path.
Sourcepub fn project_dir(
&self,
relative: impl AsRef<Path>,
) -> Result<PathBuf, ArtifactPathError>
pub fn project_dir( &self, relative: impl AsRef<Path>, ) -> Result<PathBuf, ArtifactPathError>
Resolve a relative directory beneath this root without creating it.
Existing components must be real directories, never symbolic links. Once a missing component is reached there cannot be a deeper existing component, so the remaining validated path can be projected safely.
Sourcepub fn prepare_dir(
&self,
relative: impl AsRef<Path>,
) -> Result<PathBuf, ArtifactPathError>
pub fn prepare_dir( &self, relative: impl AsRef<Path>, ) -> Result<PathBuf, ArtifactPathError>
Prepare a relative directory, rejecting traversal and symlink components.
Sourcepub fn prepare_file(
&self,
relative: impl AsRef<Path>,
) -> Result<PathBuf, ArtifactPathError>
pub fn prepare_file( &self, relative: impl AsRef<Path>, ) -> Result<PathBuf, ArtifactPathError>
Prepare a relative file’s parent directories and validate its destination.
This does not create or truncate the file. An existing destination must be a regular file and must not be a symlink.
Trait Implementations§
Source§impl Clone for ApprovedRoot
impl Clone for ApprovedRoot
Source§impl Debug for ApprovedRoot
impl Debug for ApprovedRoot
impl Eq for ApprovedRoot
Source§impl PartialEq for ApprovedRoot
impl PartialEq for ApprovedRoot
impl StructuralPartialEq for ApprovedRoot
Auto Trait Implementations§
impl Freeze for ApprovedRoot
impl RefUnwindSafe for ApprovedRoot
impl Send for ApprovedRoot
impl Sync for ApprovedRoot
impl Unpin for ApprovedRoot
impl UnsafeUnpin for ApprovedRoot
impl UnwindSafe for ApprovedRoot
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