60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
/// Invalid bounds for a variable.
InvalidBounds { lower: Real, upper: Real },
/// The value of a variable is outside its bounds.
ViolatedBounds { lower: Real, upper: Real, value: Real },
/// The variable index is out of bounds.
InvalidVariable { index: usize, nvars: usize },
/// An error occurred in a subprocess.
Process(Box<dyn std::error::Error>),
/// A method requiring an initialized solver has been called.
NotInitialized,
/// The problem has not been solved yet.
NotSolved,
}
impl<E> std::fmt::Display for Error<E>
|
|
|
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
/// Invalid bounds for a variable.
InvalidBounds { lower: Real, upper: Real },
/// The value of a variable is outside its bounds.
ViolatedBounds { lower: Real, upper: Real, value: Real },
/// The variable index is out of bounds.
InvalidVariable { index: usize, nvars: usize },
/// An error occurred in a subprocess.
Process(RecvError),
/// A method requiring an initialized solver has been called.
NotInitialized,
/// The problem has not been solved yet.
NotSolved,
}
impl<E> std::fmt::Display for Error<E>
|
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
{
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
use Error::*;
match self {
BuildMaster(err) => Some(err.as_ref()),
Master(err) => Some(err.as_ref()),
Evaluation(err) => Some(err),
Process(err) => Some(err.as_ref()),
_ => None,
}
}
}
impl<E, MErr> From<masterprocess::Error<MErr>> for Error<E>
where
|
|
|
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
{
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
use Error::*;
match self {
BuildMaster(err) => Some(err.as_ref()),
Master(err) => Some(err.as_ref()),
Evaluation(err) => Some(err),
Process(err) => Some(err),
_ => None,
}
}
}
impl<E, MErr> From<masterprocess::Error<MErr>> for Error<E>
where
|