pub struct ErrorContext {
pub command_path: Option<String>,
pub usage: Option<String>,
pub help_option_names: Vec<String>,
pub color: Option<bool>,
}Expand description
Context information for error formatting.
This struct holds contextual information that can be attached to errors to provide better error messages and help hints.
Fields§
§command_path: Option<String>The command path (e.g., “myapp subcommand”)
usage: Option<String>The usage string for the command
help_option_names: Vec<String>Available help option names (e.g., [“–help”, “-h”])
color: Option<bool>Whether color output is enabled
Implementations§
Source§impl ErrorContext
impl ErrorContext
Sourcepub fn with_command_path(self, path: impl Into<String>) -> Self
pub fn with_command_path(self, path: impl Into<String>) -> Self
Set the command path.
Sourcepub fn with_usage(self, usage: impl Into<String>) -> Self
pub fn with_usage(self, usage: impl Into<String>) -> Self
Set the usage string.
Sourcepub fn with_help_options(self, options: Vec<String>) -> Self
pub fn with_help_options(self, options: Vec<String>) -> Self
Set the help option names.
Trait Implementations§
Source§impl Clone for ErrorContext
impl Clone for ErrorContext
Source§fn clone(&self) -> ErrorContext
fn clone(&self) -> ErrorContext
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ErrorContext
impl Debug for ErrorContext
Source§impl Default for ErrorContext
impl Default for ErrorContext
Source§fn default() -> ErrorContext
fn default() -> ErrorContext
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ErrorContext
impl RefUnwindSafe for ErrorContext
impl Send for ErrorContext
impl Sync for ErrorContext
impl Unpin for ErrorContext
impl UnsafeUnpin for ErrorContext
impl UnwindSafe for ErrorContext
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