pub trait PathExt {
// Required methods
fn is_clean(&self) -> bool;
fn is_dirty(&self) -> bool;
fn has_clean_file_name(&self) -> bool;
fn has_dirty_file_name(&self) -> bool;
}Expand description
Extension trait for std::path::Path.
Required Methods§
Sourcefn is_clean(&self) -> bool
fn is_clean(&self) -> bool
Returns true if the path does not contain banned characters.
§Example
use ntfsanitise::PathExt;
use std::path::PathBuf;
assert!(PathBuf::from("/a/clean/path").is_clean());Sourcefn is_dirty(&self) -> bool
fn is_dirty(&self) -> bool
Returns true if the path contains banned characters.
§Example
use ntfsanitise::PathExt;
use std::path::PathBuf;
assert!(PathBuf::from("/a/dirty?/p<a>th").is_dirty())Sourcefn has_clean_file_name(&self) -> bool
fn has_clean_file_name(&self) -> bool
Returns true if the path’s file name does not contain banned characters, or if the path has
no file name.
§Example
use ntfsanitise::PathExt;
use std::path::PathBuf;
assert!(PathBuf::from("/my/clean_file.name").has_clean_file_name());
assert!(PathBuf::from("/no/file/name/").has_clean_file_name());
assert!(PathBuf::from("/dirty<path>/with/clean_file.name").has_clean_file_name());Sourcefn has_dirty_file_name(&self) -> bool
fn has_dirty_file_name(&self) -> bool
Returns true if the path’s file name contains banned characters.
§Example
use ntfsanitise::PathExt;
use std::path::PathBuf;
assert!(PathBuf::from("/my/dirty<file>.name").has_dirty_file_name());