pub struct ExcelError {
pub kind: ExcelErrorKind,
/* private fields */
}Expand description
The single struct your API passes around.
It combines:
- kind – the mandatory Excel error code
- message– optional human explanation
- context– generic location†
- extra – optional, kind-specific data
† If you never need row/col you can build the value with
ExcelError::from(kind), which sets context = None.
Fields§
§kind: ExcelErrorKindImplementations§
Source§impl ExcelError
impl ExcelError
Sourcepub fn from_function_panic(
function: &str,
payload: &(dyn Any + Send + 'static),
) -> ExcelError
pub fn from_function_panic( function: &str, payload: &(dyn Any + Send + 'static), ) -> ExcelError
Convert an unwinding Rust function panic to a typed #VALUE! error.
Sourcepub fn new(kind: ExcelErrorKind) -> ExcelError
pub fn new(kind: ExcelErrorKind) -> ExcelError
Basic constructor (no message, no location, no extra).
Sourcepub fn context(&self) -> Option<&ErrorContext>
pub fn context(&self) -> Option<&ErrorContext>
Generic location metadata, if supplied.
Sourcepub fn extra(&self) -> &ExcelErrorExtra
pub fn extra(&self) -> &ExcelErrorExtra
Kind-specific data; payload-free errors return ExcelErrorExtra::None.
Sourcepub fn set_message(&mut self, message: Option<String>)
pub fn set_message(&mut self, message: Option<String>)
Replace or clear the explanation, retaining any other metadata.
Sourcepub fn set_context(&mut self, context: Option<ErrorContext>)
pub fn set_context(&mut self, context: Option<ErrorContext>)
Replace or clear the location, retaining any other metadata.
Sourcepub fn set_extra(&mut self, extra: ExcelErrorExtra)
pub fn set_extra(&mut self, extra: ExcelErrorExtra)
Replace or clear the kind-specific data, retaining any other metadata.
Sourcepub fn with_message<S>(self, msg: S) -> ExcelError
pub fn with_message<S>(self, msg: S) -> ExcelError
Attach a human-readable explanation.
Sourcepub fn with_location(self, row: u32, col: u32) -> ExcelError
pub fn with_location(self, row: u32, col: u32) -> ExcelError
Attach generic row/column coordinates.
Sourcepub fn with_origin(
self,
sheet: Option<String>,
row: u32,
col: u32,
) -> ExcelError
pub fn with_origin( self, sheet: Option<String>, row: u32, col: u32, ) -> ExcelError
Attach origin location where the error first occurred.
Sourcepub fn with_extra(self, extra: ExcelErrorExtra) -> ExcelError
pub fn with_extra(self, extra: ExcelErrorExtra) -> ExcelError
Attach kind-specific extra data.
pub fn from_error_string(s: &str) -> ExcelError
pub fn new_value() -> ExcelError
pub fn new_name() -> ExcelError
pub fn new_div() -> ExcelError
pub fn new_ref() -> ExcelError
pub fn new_circ() -> ExcelError
pub fn new_num() -> ExcelError
pub fn new_na() -> ExcelError
Trait Implementations§
Source§impl Clone for ExcelError
impl Clone for ExcelError
Source§fn clone(&self) -> ExcelError
fn clone(&self) -> ExcelError
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 ExcelError
impl Debug for ExcelError
Source§impl Display for ExcelError
impl Display for ExcelError
impl Eq for ExcelError
Source§impl Error for ExcelError
impl Error for ExcelError
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()