pub struct SafePath(/* private fields */);Expand description
Newtype wrapper for validated safe paths.
Paths wrapped in SafePath have been validated to not contain
path traversal attempts, absolute paths, or banned components.
Implementations§
Source§impl SafePath
impl SafePath
Sourcepub fn new(path: PathBuf, config: &SecurityConfig) -> Result<Self>
pub fn new(path: PathBuf, config: &SecurityConfig) -> Result<Self>
Creates a new SafePath after validation.
§Errors
Returns an error if the path contains traversal attempts, is absolute, or contains banned components.
Sourcepub fn into_path_buf(self) -> PathBuf
pub fn into_path_buf(self) -> PathBuf
Converts into the inner PathBuf.
Trait Implementations§
impl Eq for SafePath
impl StructuralPartialEq for SafePath
Auto Trait Implementations§
impl Freeze for SafePath
impl RefUnwindSafe for SafePath
impl Send for SafePath
impl Sync for SafePath
impl Unpin for SafePath
impl UnwindSafe for SafePath
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