pub struct FileName(/* private fields */);Expand description
A single path component: 1 to 255 bytes, no separators, not . or ..,
no NUL. Validated once at construction so backends never see a path that
could escape its directory.
Implementations§
Source§impl FileName
impl FileName
Sourcepub fn new(name: &str) -> Result<Self, InvalidFileName>
pub fn new(name: &str) -> Result<Self, InvalidFileName>
Validates a file name.
§Errors
InvalidFileName for an empty, overlong, ./.., or separator- or
NUL-containing name.
§Examples
use store_io_platform::FileName;
assert!(FileName::new("store.sio").is_ok());
assert!(FileName::new("../etc").is_err());
assert!(FileName::new("a/b").is_err());Trait Implementations§
impl Eq for FileName
impl StructuralPartialEq for FileName
Auto Trait Implementations§
impl Forget for FileName
impl Freeze for FileName
impl Move for FileName
impl RefUnwindSafe for FileName
impl Send for FileName
impl Sync for FileName
impl Unpin for FileName
impl UnsafeUnpin for FileName
impl UnwindSafe for FileName
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