#[non_exhaustive]pub enum UnitError {
Show 16 variants
Undefined {
from: u64,
to: u64,
},
NotAUnit {
instance: u64,
entity: String,
},
Unsupported {
instance: u64,
entity: String,
},
Malformed {
instance: u64,
reason: &'static str,
},
NotPositive {
instance: u64,
value: f64,
},
KindMismatch {
instance: u64,
declared: UnitKind,
found: UnitKind,
},
TooDeep {
instance: u64,
},
NotAContext {
instance: u64,
entity: String,
},
NotARepresentation {
instance: u64,
entity: String,
},
Missing {
context: u64,
kind: UnitKind,
},
Ambiguous {
context: u64,
kind: UnitKind,
units: Vec<u64>,
},
Unreadable {
context: u64,
unit: u64,
reason: Box<UnitError>,
},
NotHeld {
item: u64,
},
NotFollowed {
item: u64,
container: u64,
entity: String,
},
HolderUnreadable {
item: u64,
holder: u64,
reason: Box<UnitError>,
},
ContextsDisagree {
item: u64,
kind: Option<UnitKind>,
contexts: [u64; 2],
},
}Expand description
Why a unit, one kind of a context’s units, its uncertainties or the units of an item cannot be read as stated.
Each variant names the innermost instance at fault.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Undefined
An instance refers to an #id that is not defined. When to is the
#id the caller passed, from equals to.
NotAUnit
Not a unit at all, such as a DIMENSIONAL_EXPONENTS or a measure
with unit.
Unsupported
Valid STEP that stepq does not read: a unit of another quantity (mass, time, …), a derived unit, a context-dependent unit (which states no factor), an SI unit such as the gram, or a named unit that is neither SI nor conversion-based.
Malformed
Contradicts the schema: a wrong number of attributes, an attribute of
the wrong type, an unknown SI prefix or SI unit name, an SI unit that
is also conversion-based, a complex instance that repeats a partial
entity, or a unit or uncertainty set that is $, empty or lists
something other than references.
NotPositive
A conversion factor or uncertainty that is not a positive finite number once converted: zero, negative or too large.
KindMismatch
The unit’s statements of its kind disagree: its kind record, its SI name, its base unit, its factor’s measure type, its factor’s value type or its dimensional exponents. All-zero exponents, which every angle has, are reported as a plane angle.
Fields
TooDeep
A chain of conversion-based units more than 8 deep, or a cycle.
NotAContext
Not a representation context.
NotARepresentation
Not a representation, or not one with a string name, a list of item references and a context reference.
Missing
The context assigns no unit of this kind.
Ambiguous
The context assigns several units of this kind whose factors differ.
Fields
Unreadable
A unit the context assigns cannot be read, and it is of this kind or its kind cannot be told (it may be the length unit). Another readable unit of the same kind does not make up for it.
NotHeld
No representation holds the item, directly or through a container stepq knows.
NotFollowed
Something that refers to the item, or to a container holding it, may hold it but is not followed: a shell, solid or model written as a complex instance, or an instance that lists it next to a reference that is not a context. A representation behind it could hold the item in another context, so the item is not read from the others.
Fields
HolderUnreadable
A representation that lists the item, or that representation’s context, cannot be read. The item is not read from the others.
Fields
ContextsDisagree
The item is held in contexts that disagree.
Trait Implementations§
Source§impl Error for UnitError
impl Error for UnitError
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()