pub struct InputPath { /* private fields */ }
Expand description
A builder for Input that validates the path but defers creating it until you call the create method.
It is designed to be used with the clap
crate when taking a file name as an
argument to CLI app
use clap::Parser;
use clio::InputPath;
#[derive(Parser)]
struct Opt {
/// path to file, use '-' for stdin
#[clap(value_parser)]
input_file: InputPath,
}
Implementations
sourceimpl InputPath
impl InputPath
sourcepub fn new<S: AsRef<OsStr>>(path: S) -> Result<Self>
pub fn new<S: AsRef<OsStr>>(path: S) -> Result<Self>
Contructs a new InputPath
representing the path and checking that the file exists and is readable
note: even if this passes open may still fail if e.g. the file was delete in between
Trait Implementations
impl Eq for InputPath
impl StructuralEq for InputPath
impl StructuralPartialEq for InputPath
Auto Trait Implementations
impl RefUnwindSafe for InputPath
impl Send for InputPath
impl Sync for InputPath
impl Unpin for InputPath
impl UnwindSafe for InputPath
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more