pub struct ScanTarget { /* private fields */ }Expand description
A validated scan target path.
Ensures the path exists at construction time.
Implementations§
Source§impl ScanTarget
impl ScanTarget
Sourcepub fn new(path: impl AsRef<Path>) -> Result<Self, PathValidationError>
pub fn new(path: impl AsRef<Path>) -> Result<Self, PathValidationError>
Create a new ScanTarget after validating the path exists.
Sourcepub fn file(path: impl AsRef<Path>) -> Result<Self, PathValidationError>
pub fn file(path: impl AsRef<Path>) -> Result<Self, PathValidationError>
Create a ScanTarget for a file, validating it’s actually a file.
Sourcepub fn directory(path: impl AsRef<Path>) -> Result<Self, PathValidationError>
pub fn directory(path: impl AsRef<Path>) -> Result<Self, PathValidationError>
Create a ScanTarget for a directory, validating it’s actually a directory.
Sourcepub fn unchecked(path: impl AsRef<Path>) -> Self
pub fn unchecked(path: impl AsRef<Path>) -> Self
Create a ScanTarget without validation (for testing or trusted paths).
§Safety
The caller must ensure the path is valid for the intended use.
Sourcepub fn to_path_buf(&self) -> PathBuf
pub fn to_path_buf(&self) -> PathBuf
Get the path as a PathBuf.
Sourcepub fn into_path_buf(self) -> PathBuf
pub fn into_path_buf(self) -> PathBuf
Consume self and return the inner PathBuf.
Trait Implementations§
Source§impl AsRef<Path> for ScanTarget
impl AsRef<Path> for ScanTarget
Source§impl Clone for ScanTarget
impl Clone for ScanTarget
Source§fn clone(&self) -> ScanTarget
fn clone(&self) -> ScanTarget
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 moreSource§impl Debug for ScanTarget
impl Debug for ScanTarget
Source§impl From<ScanTarget> for PathBuf
impl From<ScanTarget> for PathBuf
Source§fn from(target: ScanTarget) -> Self
fn from(target: ScanTarget) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for ScanTarget
impl RefUnwindSafe for ScanTarget
impl Send for ScanTarget
impl Sync for ScanTarget
impl Unpin for ScanTarget
impl UnwindSafe for ScanTarget
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