Struct flexi_parse::error::Error
source · pub struct Error { /* private fields */ }
Expand description
Implementations§
source§impl Error
impl Error
sourcepub fn with(self, other: Error) -> Self
pub fn with(self, other: Error) -> Self
Consumes self
and other
, returning a new error with the contents of
both.
Examples found in repository?
examples/lox.rs (line 618)
604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623
fn parse(input: ParseStream<'_>) -> Result<Self> {
let mut stmts = vec![];
let mut errors = vec![];
while !input.is_empty() {
match input.parse() {
Ok(stmt) => stmts.push(stmt),
Err(err) => {
Ast::synchronise(input);
errors.push(err);
}
}
}
if let Some(error) = errors.into_iter().reduce(|acc, err| acc.with(err)) {
Err(error)
} else {
Ok(Ast(stmts))
}
}
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Error
impl !Send for Error
impl !Sync for Error
impl Unpin for Error
impl UnwindSafe for Error
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