pub struct ValidationResult {
pub errors: Vec<ConfigError>,
pub warnings: Vec<String>,
}Expand description
Validation result with all errors collected
Fields§
§errors: Vec<ConfigError>Collected configuration errors; non-empty means the config is invalid.
warnings: Vec<String>Non-fatal warnings about potentially unintended settings.
Implementations§
Source§impl ValidationResult
impl ValidationResult
Sourcepub fn add_error(&mut self, error: ConfigError)
pub fn add_error(&mut self, error: ConfigError)
Add a configuration error to the result.
Sourcepub fn add_warning(&mut self, warning: impl Into<String>)
pub fn add_warning(&mut self, warning: impl Into<String>)
Add a non-fatal warning to the result.
Sourcepub fn into_result(self) -> Result<Vec<String>, ConfigError>
pub fn into_result(self) -> Result<Vec<String>, ConfigError>
Convert the validation result into a standard Result.
§Errors
Returns the single ConfigError if exactly one error was collected.
Returns ConfigError::MultipleErrors if more than one error was collected.
§Panics
Cannot panic in practice — the expect on into_iter().next() is
guarded by a preceding len() == 1 check.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ValidationResult
impl !RefUnwindSafe for ValidationResult
impl Send for ValidationResult
impl Sync for ValidationResult
impl Unpin for ValidationResult
impl UnsafeUnpin for ValidationResult
impl !UnwindSafe for ValidationResult
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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