pub struct SafePath(/* private fields */);Expand description
A validated relative file-system path.
Rejects directory traversal (../, ..\), absolute paths, null bytes,
and percent-encoded traversal sequences.
§Examples
use secure_boundary::safe_types::SafePath;
let path = SafePath::try_from("uploads/photo.jpg").unwrap();
assert_eq!(path.as_inner(), "uploads/photo.jpg");
// Traversal attempts are rejected.
assert!(SafePath::try_from("../../etc/passwd").is_err());Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for SafePath
impl<'de> Deserialize<'de> for SafePath
Source§fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
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 UnsafeUnpin 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