pub struct ExcelError {
pub kind: ExcelErrorKind,
pub message: Option<String>,
pub context: Option<ErrorContext>,
pub extra: ExcelErrorExtra,
}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: ExcelErrorKind§message: Option<String>§context: Option<ErrorContext>§extra: ExcelErrorExtraImplementations§
Source§impl ExcelError
impl ExcelError
Sourcepub fn new(kind: ExcelErrorKind) -> Self
pub fn new(kind: ExcelErrorKind) -> Self
Basic constructor (no message, no location, no extra).
Sourcepub fn with_message<S: Into<String>>(self, msg: S) -> Self
pub fn with_message<S: Into<String>>(self, msg: S) -> Self
Attach a human-readable explanation.
Sourcepub fn with_location(self, row: u32, col: u32) -> Self
pub fn with_location(self, row: u32, col: u32) -> Self
Attach generic row/column coordinates.
Sourcepub fn with_origin(self, sheet: Option<String>, row: u32, col: u32) -> Self
pub fn with_origin(self, sheet: Option<String>, row: u32, col: u32) -> Self
Attach origin location where the error first occurred.
Sourcepub fn with_extra(self, extra: ExcelErrorExtra) -> Self
pub fn with_extra(self, extra: ExcelErrorExtra) -> Self
Attach kind-specific extra data.
pub fn from_error_string(s: &str) -> Self
pub fn new_value() -> Self
pub fn new_name() -> Self
pub fn new_div() -> Self
pub fn new_ref() -> Self
pub fn new_circ() -> Self
pub fn new_num() -> Self
pub fn new_na() -> Self
Trait Implementations§
Source§impl Clone for ExcelError
impl Clone for ExcelError
Source§fn clone(&self) -> ExcelError
fn clone(&self) -> ExcelError
Returns a duplicate of the value. Read more
1.0.0 · 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 ExcelError
impl Debug for ExcelError
Source§impl Display for ExcelError
impl Display 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)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl From<ExcelError> for LiteralValue
impl From<ExcelError> for LiteralValue
Source§fn from(error: ExcelError) -> Self
fn from(error: ExcelError) -> Self
Converts to this type from the input type.
Source§impl From<ExcelError> for String
impl From<ExcelError> for String
Source§fn from(error: ExcelError) -> Self
fn from(error: ExcelError) -> Self
Converts to this type from the input type.
Source§impl From<ExcelErrorKind> for ExcelError
impl From<ExcelErrorKind> for ExcelError
Source§fn from(kind: ExcelErrorKind) -> Self
fn from(kind: ExcelErrorKind) -> Self
Converts to this type from the input type.
Source§impl Hash for ExcelError
impl Hash for ExcelError
Source§impl PartialEq<&str> for ExcelError
impl PartialEq<&str> for ExcelError
Source§impl PartialEq<str> for ExcelError
impl PartialEq<str> for ExcelError
Source§impl PartialEq for ExcelError
impl PartialEq for ExcelError
impl Eq for ExcelError
impl StructuralPartialEq for ExcelError
Auto Trait Implementations§
impl Freeze for ExcelError
impl RefUnwindSafe for ExcelError
impl Send for ExcelError
impl Sync for ExcelError
impl Unpin for ExcelError
impl UnwindSafe for ExcelError
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