pub enum ParseError {
Read(Error),
UnexpectedRecord {
found: RecordKind,
expected: RecordKind,
},
UnexpectedEof,
}
Expand description
All possible errors that can occur when parsing LCOV records.
Variants§
Read(Error)
An error indicating that reading record operation failed.
This error occurs when the underlying reader returns an error.
§Examples
use lcov::{Reader, Report};
use lcov::report::ParseError;
assert_matches!(Report::from_reader(Reader::new("FOO:1,2,3".as_bytes())), Err(ParseError::Read(_)));
UnexpectedRecord
An error indicating that unexpected kind of record is read.
This error occurs when the LCOV tracefile (or underlying reader) contains invalid record sequence.
§Examples
use lcov::{Reader, Report, RecordKind};
use lcov::report::ParseError;
let input = "\
TN:test_name
SF:/usr/include/stdio.h
TN:next_test
";
assert_matches!(Report::from_reader(Reader::new(input.as_bytes())),
Err(ParseError::UnexpectedRecord { found: RecordKind::TestName, expected: RecordKind::EndOfRecord }));
UnexpectedEof
An error indicating that unexpected “end of file”.
This error occurs when the LCOV tracefile (or underlying reader) contains invalid record sequence.
§Examples
use lcov::{Reader, Report};
use lcov::report::ParseError;
let input = "\
TN:test_name
SF:/usr/include/stdio.h
";
assert_matches!(Report::from_reader(Reader::new(input.as_bytes())),
Err(ParseError::UnexpectedEof));
Trait Implementations§
Source§impl Debug for ParseError
impl Debug for ParseError
Source§impl Display for ParseError
impl Display for ParseError
Source§impl Error for ParseError
impl Error for ParseError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for ParseError
impl !RefUnwindSafe for ParseError
impl Send for ParseError
impl Sync for ParseError
impl Unpin for ParseError
impl !UnwindSafe for ParseError
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