Expand description
The error type of comnum.
Every fallible function returns Result<T>, whose error says what kind of mistake
was made: an invalid configuration (a parameter out of its domain), inconsistent
sizes, a numerical failure (a non-finite value, a singular system), a missing value
in a simulation condition, or an input/output error.
The crates of layers 0 to 4 share this one enum, re-exported as comnum::Error, so
that ? composes across blocks of different crates inside a simulation trial (see
docs/adr/0003-shared-error-type.md).
§Examples
use comnum_core::{ensure, Error};
let err = ensure(false, || "order must be a power of two, got 6".into()).unwrap_err();
assert!(matches!(err, Error::Config(_)));
assert_eq!(err.context("qam").to_string(), "invalid configuration: qam: order must be a power of two, got 6");Enums§
- Error
- The error of every fallible operation of comnum.
Functions§
- ensure
- Return
Error::Configwith the message ofmsgunlessok. - ensure_
shape - Return
Error::Shapewith the message ofmsgunlessok(inconsistent lengths or shapes;ensurefor a parameter outside its domain). - expect_
len - Return
Error::Shapeunless a block ofgotelements has thewantexpected (whatnames the elements). - same_
len - Return
Error::Shapeunlessa == b(whatnames the two inputs).
Type Aliases§
- Result
Resultwith the error type of comnum.