pub struct BraceExpander { /* private fields */ }Expand description
Brace expander
Implementations§
Source§impl BraceExpander
impl BraceExpander
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Create a new default BraceExpander with sensible options
This is the same as calling Default::default() but it is a const method
Sourcepub const fn ignore_parse_failures(self, value: bool) -> Self
pub const fn ignore_parse_failures(self, value: bool) -> Self
Ignore parse failures instead of erroring out, making the parsing stage infallible. This is how Bash behaves.
§Example
let be = BraceExpander::new().ignore_parse_failures(false);
assert!(be.expand("{1...10}").is_err());
let be = be.ignore_parse_failures(true);
assert_eq!(be.expand("{1...10}").unwrap().join(" "), "{1...10}");Default: false
Sourcepub const fn interpret_backslashes(self, value: bool) -> Self
pub const fn interpret_backslashes(self, value: bool) -> Self
Interpret backslashes as a method of escaping a character as text. Enabling this makes the tokenization process fallible (fails on backslash with nothing following it).
§Example
let be = BraceExpander::new().interpret_backslashes(false);
assert_eq!(be.expand("\\{a,b}").unwrap().join(" "), "\\a \\b");
let be = be.interpret_backslashes(true);
assert_eq!(be.expand("\\{a,b}").unwrap().join(" "), "{a,b}");Default: false
Trait Implementations§
Source§impl Clone for BraceExpander
impl Clone for BraceExpander
Source§fn clone(&self) -> BraceExpander
fn clone(&self) -> BraceExpander
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 BraceExpander
impl Debug for BraceExpander
Auto Trait Implementations§
impl Freeze for BraceExpander
impl RefUnwindSafe for BraceExpander
impl Send for BraceExpander
impl Sync for BraceExpander
impl Unpin for BraceExpander
impl UnsafeUnpin for BraceExpander
impl UnwindSafe for BraceExpander
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more