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) -> ExcelError
pub fn new(kind: ExcelErrorKind) -> ExcelError
Basic constructor (no message, no location, no extra).
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
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) -> LiteralValue
fn from(error: ExcelError) -> LiteralValue
Converts to this type from the input type.
Source§impl From<ExcelErrorKind> for ExcelError
impl From<ExcelErrorKind> for ExcelError
Source§fn from(kind: ExcelErrorKind) -> ExcelError
fn from(kind: ExcelErrorKind) -> ExcelError
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