pub enum Error {
Input(String),
Drift {
eps: f64,
},
NoAbsorber {
eps: f64,
},
LostProbability {
units: usize,
},
Internal(String),
}Expand description
Why a procedure refused to run, or could not finish.
Refusals are loud on purpose: a sampling procedure that silently mends its input produces a sample whose inclusion probabilities nobody knows, and the weights built from them estimate nothing.
Variants§
Input(String)
The input cannot define a valid selection — a negative size, a
uniform outside [0, 1), mismatched lengths. The message says which.
Drift
The expected hits summed too far from an integer to be a sample
size: the drift exceeds the procedure’s tolerance of 1e-8, so the
caller’s expected hits do not add to a whole number of selections.
NoAbsorber
The floating-point drift could not be absorbed: no unit has a fractional expected hit large enough to take the correction.
LostProbability
After the corrections, units with positive expected hits were left with no probability of selection at all. Their weights would be infinite; the selection is refused instead.
Internal(String)
The procedure’s own accounting failed — realised hits that do not add to the sample size. This is a bug in the crate, not in the input; please report it.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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()