#[non_exhaustive]pub enum UcumError {
Parse {
pos: usize,
msg: String,
},
UnknownAtom {
code: String,
},
NotComparable {
from: String,
to: String,
},
UnsupportedSpecial {
unit: String,
},
}Expand description
Errors produced by parsing, validation, analysis and conversion.
Every public function in this crate is total: it returns one of these errors rather than panicking or looping forever on malformed input.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Parse
The input is not syntactically a valid UCUM expression.
pos is the byte offset into the input at which the problem was
detected.
Fields
UnknownAtom
A unit token was syntactically well-formed but is not a known UCUM atom (optionally with a prefix).
NotComparable
Two units were compared or converted but have different dimensions.
UnsupportedSpecial
Conversion was requested for a special (non-multiplicative) unit whose conversion is not supported, e.g. a logarithmic, arbitrary, or otherwise non-affine unit, or an affine unit used inside a compound term.
Trait Implementations§
impl Eq for UcumError
Source§impl Error for UcumError
impl Error for UcumError
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()
impl StructuralPartialEq for UcumError
Auto Trait Implementations§
impl Freeze for UcumError
impl RefUnwindSafe for UcumError
impl Send for UcumError
impl Sync for UcumError
impl Unpin for UcumError
impl UnsafeUnpin for UcumError
impl UnwindSafe for UcumError
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