pub struct PathValidator { /* private fields */ }Expand description
路径验证器
Implementations§
Source§impl PathValidator
impl PathValidator
Sourcepub fn new(restriction: PathRestriction) -> Self
pub fn new(restriction: PathRestriction) -> Self
创建新的路径验证器
Sourcepub fn with_root_dir(root_dir: PathBuf) -> Self
pub fn with_root_dir(root_dir: PathBuf) -> Self
从根目录创建验证器(默认严格配置)
Sourcepub fn validate_and_normalize(
&self,
path: &Path,
) -> Result<PathBuf, PathValidationError>
pub fn validate_and_normalize( &self, path: &Path, ) -> Result<PathBuf, PathValidationError>
验证并规范化路径
返回规范化的绝对路径,如果验证失败则返回错误
Sourcepub fn restriction(&self) -> &PathRestriction
pub fn restriction(&self) -> &PathRestriction
获取路径限制配置
Trait Implementations§
Source§impl Clone for PathValidator
impl Clone for PathValidator
Source§fn clone(&self) -> PathValidator
fn clone(&self) -> PathValidator
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for PathValidator
impl RefUnwindSafe for PathValidator
impl Send for PathValidator
impl Sync for PathValidator
impl Unpin for PathValidator
impl UnwindSafe for PathValidator
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