pub struct ParseOptions { /* private fields */ }Expand description
Options for configuring command-line parsing.
For backwards compatibility with 2.1, you can convert a bool into this
type. true will be the default, and false will be no_strict_escapes.
Implementations§
Source§impl ParseOptions
impl ParseOptions
Sourcepub const fn new() -> ParseOptions
pub const fn new() -> ParseOptions
Create a new ParseOptions starting at the defaults.
Equivalent to ParseOptions::default(), except that it’s a const fn
so you can put it into a const variable if you like.
Sourcepub const fn no_strict_escapes(self) -> Self
pub const fn no_strict_escapes(self) -> Self
The default is for bad escape sequences to result in a ParseError.
If no_strict_escapes() is used, then bad escape sequences will result
in ‘�’ instead.
Sourcepub const fn comment_char(self, comment_char: Option<char>) -> Self
pub const fn comment_char(self, comment_char: Option<char>) -> Self
The default is for comments to be delimited by a # character. You can
specify another comment character, or disable comment delimiting,
using comment_char().
Sourcepub const fn allow_comments_within_elements(self) -> Self
pub const fn allow_comments_within_elements(self) -> Self
The default is that comments will only count if they are preceded by
whitespace. Thus, by default, foo bar#baz # bang will parse as
["foo", "bar#baz"]. This matches the behavior of the Bourne shell.
You can override this behavior by calling
allow_comments_within_elements(), which would make that line parse
as ["foo", "bar"] instead.
Trait Implementations§
Source§impl Clone for ParseOptions
impl Clone for ParseOptions
Source§fn clone(&self) -> ParseOptions
fn clone(&self) -> ParseOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more