#[non_exhaustive]pub enum Error {
Io(Error),
NotRegularFile,
FileTooLarge,
EmptyFilesCannotDiffer,
EmptyLinesCannotDiffer,
InvalidLineNumber,
InvalidBytePosition,
SearchAlreadyComplete,
}Expand description
An error returned by a core operation.
This enum is non-exhaustive so new variants can be added in future releases. Callers outside this crate must include a wildcard arm when matching:
use paircomp_core::Error;
fn report(error: &Error) {
match error {
Error::Io(source) => eprintln!("I/O error: {source}"),
_ => eprintln!("{error}"),
}
}Matching only the currently known variants does not compile:
use paircomp_core::Error;
fn report(error: &Error) {
match error {
Error::Io(_) => {},
Error::NotRegularFile
| Error::FileTooLarge
| Error::EmptyFilesCannotDiffer
| Error::EmptyLinesCannotDiffer
| Error::InvalidLineNumber
| Error::InvalidBytePosition
| Error::SearchAlreadyComplete => {},
}
}Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Io(Error)
Metadata lookup, opening, or reading the file failed.
NotRegularFile
The path does not identify a regular file.
FileTooLarge
A byte count, line count, or character position cannot fit in u64.
EmptyFilesCannotDiffer
Both supplied line counts are zero despite a reported mismatch.
EmptyLinesCannotDiffer
Both supplied line byte lengths are zero despite a reported mismatch.
InvalidLineNumber
A line-local operation was given line zero; its lines start at 1.
InvalidBytePosition
The byte position is zero or more than one past the selected line.
An absent line permits only byte position 1.
SearchAlreadyComplete
An answer was submitted after the search had reached its result.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn StdError + 'static)>
fn source(&self) -> Option<&(dyn StdError + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()