pub enum SimError {
Show 15 variants
NonFiniteValue {
location: String,
},
EnergyDrift {
drift: f64,
tolerance: f64,
},
ConstraintViolation {
name: String,
violation: f64,
tolerance: f64,
},
Config {
message: String,
},
YamlParse(Error),
Validation(ValidationErrors),
CheckpointIntegrity,
CheckpointNotFound(SimTime),
Journal(String),
Io(Error),
Serialization(String),
Physics(String),
MonteCarlo(String),
Optimization(String),
HypothesisFalsified {
reason: String,
p_value: f64,
},
}Expand description
Unified error type for all simular operations.
§Design
Following Toyota’s Jidoka principle, errors are:
- Immediately detectable (type-safe)
- Self-documenting (descriptive variants)
- Actionable (contain recovery hints)
Variants§
NonFiniteValue
Numerical instability detected (NaN or Inf).
EnergyDrift
Energy conservation violated beyond tolerance.
Fields
ConstraintViolation
Constraint violation detected.
Fields
Config
Invalid configuration parameter.
YamlParse(Error)
YAML parsing error.
Validation(ValidationErrors)
Validation error.
CheckpointIntegrity
Checkpoint integrity violation.
CheckpointNotFound(SimTime)
Checkpoint not found.
Journal(String)
Journal read error.
Io(Error)
File I/O error.
Serialization(String)
Serialization error.
Physics(String)
Physics engine error.
MonteCarlo(String)
Monte Carlo error.
Optimization(String)
Optimization error.
HypothesisFalsified
Hypothesis falsified.
Implementations§
Source§impl SimError
impl SimError
Sourcepub fn serialization(message: impl Into<String>) -> Self
pub fn serialization(message: impl Into<String>) -> Self
Create a serialization error.
Sourcepub fn optimization(message: impl Into<String>) -> Self
pub fn optimization(message: impl Into<String>) -> Self
Create an optimization error.
Sourcepub fn jidoka(message: impl Into<String>) -> Self
pub fn jidoka(message: impl Into<String>) -> Self
Create a Jidoka violation error (requires immediate stop).
Sourcepub fn io(message: impl Into<String>) -> Self
pub fn io(message: impl Into<String>) -> Self
Create an I/O error with a message (wraps in std::io::Error).
Sourcepub const fn is_jidoka_violation(&self) -> bool
pub const fn is_jidoka_violation(&self) -> bool
Check if this error is a Jidoka violation (requires immediate stop).
Trait Implementations§
Source§impl Error for SimError
impl Error for SimError
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<JidokaViolation> for SimError
impl From<JidokaViolation> for SimError
Source§fn from(v: JidokaViolation) -> Self
fn from(v: JidokaViolation) -> Self
Converts to this type from the input type.
Source§impl From<ValidationErrors> for SimError
impl From<ValidationErrors> for SimError
Source§fn from(source: ValidationErrors) -> Self
fn from(source: ValidationErrors) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for SimError
impl !RefUnwindSafe for SimError
impl Send for SimError
impl Sync for SimError
impl Unpin for SimError
impl UnsafeUnpin for SimError
impl !UnwindSafe for SimError
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
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> ValidateIp for Twhere
T: ToString,
impl<T> ValidateIp for Twhere
T: ToString,
Source§fn validate_ipv4(&self) -> bool
fn validate_ipv4(&self) -> bool
Validates whether the given string is an IP V4
Source§fn validate_ipv6(&self) -> bool
fn validate_ipv6(&self) -> bool
Validates whether the given string is an IP V6
Source§fn validate_ip(&self) -> bool
fn validate_ip(&self) -> bool
Validates whether the given string is an IP