pub struct FromStrBuilder { /* private fields */ }
Expand description
Implementations§
Source§impl FromStrBuilder
impl FromStrBuilder
Sourcepub fn add_custom_parser<F>(self, f: F) -> Self
pub fn add_custom_parser<F>(self, f: F) -> Self
Add a custom parser. A custom parser is a function which is given a mutable string reference and will:
- return
None
if the string given is not applicable, - return
Some(Ok(value))
if we can successfully parse a value from the string. In this case, the parser should update the&mut str
it’s given to consume however much was parsed. - return
Some(Err(error))
if the string given looks like a match, but something went wrong in trying to properly parse it. In this case, parsing will stop immediately and this error will be returned, so use this sparingly, as other parsers may be able to successfully parse what this one has failed to parse. No additional tokens will be consumed if an error occurs.
Auto Trait Implementations§
impl Freeze for FromStrBuilder
impl !RefUnwindSafe for FromStrBuilder
impl !Send for FromStrBuilder
impl !Sync for FromStrBuilder
impl Unpin for FromStrBuilder
impl !UnwindSafe for FromStrBuilder
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> 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