#[non_exhaustive]pub enum ValidationOutcome {
Success(Vec<Diagnostic>),
IoError(FileError),
Skipped,
}Expand description
Outcome of validating a single file.
Returned by crate::validate_file and crate::validate_file_with_registry.
The Ok path of LintResult<ValidationOutcome> covers all per-file
situations - successful validation, I/O errors, and skipped files - while
the Err path is reserved for config-level errors (e.g. invalid exclude
patterns, too many files).
Use into_diagnostics() for a
quick migration path from the previous Vec<Diagnostic> return type.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Success(Vec<Diagnostic>)
Validation ran successfully. The contained diagnostics may be empty (no issues found) or non-empty (issues found).
IoError(FileError)
The file could not be read due to an I/O or filesystem error.
Skipped
The file type is unknown and no validation was performed.
Implementations§
Source§impl ValidationOutcome
impl ValidationOutcome
Sourcepub fn is_success(&self) -> bool
pub fn is_success(&self) -> bool
Returns true if validation ran (regardless of whether diagnostics were found).
Sourcepub fn is_io_error(&self) -> bool
pub fn is_io_error(&self) -> bool
Returns true if the file could not be read.
Sourcepub fn is_skipped(&self) -> bool
pub fn is_skipped(&self) -> bool
Returns true if the file was skipped (unknown file type).
Sourcepub fn diagnostics(&self) -> &[Diagnostic]
pub fn diagnostics(&self) -> &[Diagnostic]
Borrow the diagnostics from a successful validation.
Returns an empty slice for IoError and Skipped variants.
Sourcepub fn into_diagnostics(self) -> Vec<Diagnostic>
pub fn into_diagnostics(self) -> Vec<Diagnostic>
Consume the outcome and return the diagnostics.
Success: returns the contained diagnostics.IoError: returns a singlefile::readdiagnostic describing the error.Skipped: returns an emptyVec.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ValidationOutcome
impl !RefUnwindSafe for ValidationOutcome
impl Send for ValidationOutcome
impl Sync for ValidationOutcome
impl Unpin for ValidationOutcome
impl UnsafeUnpin for ValidationOutcome
impl !UnwindSafe for ValidationOutcome
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
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>
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>
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