pub enum Error {
Serialize(String),
Deserialize(String),
InvalidTable(String),
MissingColumn(&'static str),
ConversionError(String),
InvalidType {
expected: &'static str,
got: String,
},
RowOutOfBounds {
index: usize,
len: usize,
},
ColumnOutOfBounds {
index: usize,
len: usize,
},
}Expand description
A unified error type for all toon-macro operations.
Variants§
Serialize(String)
Error during TOON serialization.
Deserialize(String)
Error during TOON deserialization/parsing.
InvalidTable(String)
Invalid TOON table structure.
MissingColumn(&'static str)
A required column is missing from the table.
ConversionError(String)
Error converting between types.
InvalidType
Invalid value type encountered.
RowOutOfBounds
Row index out of bounds.
ColumnOutOfBounds
Column index out of bounds.
Implementations§
Source§impl Error
impl Error
Sourcepub fn deserialize<S: Into<String>>(msg: S) -> Self
pub fn deserialize<S: Into<String>>(msg: S) -> Self
Create a deserialization error from a message.
Sourcepub fn invalid_table<S: Into<String>>(msg: S) -> Self
pub fn invalid_table<S: Into<String>>(msg: S) -> Self
Create an invalid table error.
Sourcepub fn missing_column(name: &'static str) -> Self
pub fn missing_column(name: &'static str) -> Self
Create a missing column error.
Sourcepub fn conversion<S: Into<String>>(msg: S) -> Self
pub fn conversion<S: Into<String>>(msg: S) -> Self
Create a conversion error.
Sourcepub fn invalid_type(expected: &'static str, got: impl Debug) -> Self
pub fn invalid_type(expected: &'static str, got: impl Debug) -> Self
Create an invalid type error.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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()
Auto Trait Implementations§
impl Freeze for Error
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnwindSafe for Error
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