pub struct ParseConfig {
    pub allow_from_stdin: bool,
    pub allow_to_stdout: bool,
    pub auto_tnamed_dst_file: bool,
    pub auto_tnamed_dst_dir: bool,
    pub default_extension: OsString,
    pub allow_inplace: bool,
}
Expand description

Use single hyphen (-) as path to indicate IO from Stdio.

Notes

  • Auto time-based unique naming (auto_tnamed_dst_) only takes effect when DST is not provided.

Fields§

§allow_from_stdin: bool§allow_to_stdout: bool§auto_tnamed_dst_file: bool§auto_tnamed_dst_dir: bool§default_extension: OsString§allow_inplace: bool

Disallowed by default. There may be a potential to open and create the same file at the same time.

Implementations§

source§

impl ParseConfig

source

pub fn new<S: AsRef<OsStr>>(default_extension: S) -> Self

source

pub fn new_with_allow_inplace<S: AsRef<OsStr>>(default_extension: S) -> Self

source

pub fn parse<P: AsRef<Path>>( &self, src: P, dst: Option<P> ) -> Result<Result<IoPairs, ParseError>>

Possible Combinations
SRC => DST:   Stdout,6   File   Dir     NotProvided
Stdin,6          1+2      1      1         1+3,5
File               2      ✓      ✓           3
Dir                ×      ×      ✓           4
  1. allow_from_stdin.
  2. allow_to_stdout.
  3. auto_tnamed_dst_file.
  4. auto_tnamed_dst_dir. Note: A directory with specified name will not be created automatically (an error will be returned if it does not exist).
  5. Note that std::env::current_dir will be used as output directory.
  6. Stdio will be always treated as a file.

Trait Implementations§

source§

impl Clone for ParseConfig

source§

fn clone(&self) -> ParseConfig

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ParseConfig

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq<ParseConfig> for ParseConfig

source§

fn eq(&self, other: &ParseConfig) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for ParseConfig

source§

impl StructuralEq for ParseConfig

source§

impl StructuralPartialEq for ParseConfig

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.