pub struct ArgumentError { /* private fields */ }Expand description
A structured argument validation failure.
The error owns its argument path and failure kind, allowing downstream
error types to inspect or preserve it without parsing display text.
Display escapes caller-provided fields into a single-line diagnostic;
accessors and Debug continue to expose the original structured values.
Implementations§
Source§impl ArgumentError
impl ArgumentError
Sourcepub fn new(path: &str, kind: ArgumentErrorKind) -> Self
pub fn new(path: &str, kind: ArgumentErrorKind) -> Self
Creates an error from an argument path and structured failure kind.
path is copied only while constructing the error. The supplied
kind is retained unchanged.
Sourcepub fn path(&self) -> &ArgumentPath
pub fn path(&self) -> &ArgumentPath
Returns the path of the argument that failed validation.
Sourcepub fn kind(&self) -> &ArgumentErrorKind
pub fn kind(&self) -> &ArgumentErrorKind
Returns the structured validation failure kind.
Sourcepub fn with_path_prefix(self, prefix: &str) -> Self
pub fn with_path_prefix(self, prefix: &str) -> Self
Sourcepub fn into_parts(self) -> (ArgumentPath, ArgumentErrorKind)
pub fn into_parts(self) -> (ArgumentPath, ArgumentErrorKind)
Consumes the error and returns its owned path and failure kind.
The first tuple element is the argument path and the second is the structured failure kind.
Trait Implementations§
Source§impl Clone for ArgumentError
impl Clone for ArgumentError
Source§fn clone(&self) -> ArgumentError
fn clone(&self) -> ArgumentError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ArgumentError
impl Debug for ArgumentError
Source§impl Display for ArgumentError
impl Display for ArgumentError
impl Eq for ArgumentError
Source§impl Error for ArgumentError
impl Error for ArgumentError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()