• Home
  • Raw
  • Download

Lines Matching refs:WeightedError

96     pub fn new<I>(weights: I) -> Result<WeightedIndex<X>, WeightedError>  in new()
103 let mut total_weight: X = iter.next().ok_or(WeightedError::NoItem)?.borrow().clone(); in new()
107 return Err(WeightedError::InvalidWeight); in new()
115 return Err(WeightedError::InvalidWeight); in new()
122 return Err(WeightedError::AllWeightsZero); in new()
142 pub fn update_weights(&mut self, new_weights: &[(usize, &X)]) -> Result<(), WeightedError> in update_weights()
161 return Err(WeightedError::InvalidWeight); in update_weights()
165 return Err(WeightedError::InvalidWeight); in update_weights()
168 return Err(WeightedError::TooMany); in update_weights()
185 return Err(WeightedError::AllWeightsZero); in update_weights()
266 WeightedError::InvalidWeight, in test_accepting_nan()
270 WeightedError::InvalidWeight, in test_accepting_nan()
274 WeightedError::InvalidWeight, in test_accepting_nan()
282 WeightedError::InvalidWeight, in test_accepting_nan()
343 WeightedError::NoItem in test_weightedindex()
347 WeightedError::AllWeightsZero in test_weightedindex()
351 WeightedError::InvalidWeight in test_weightedindex()
355 WeightedError::InvalidWeight in test_weightedindex()
359 WeightedError::InvalidWeight in test_weightedindex()
426 pub enum WeightedError { enum
442 impl ::std::error::Error for WeightedError {} implementation
444 impl fmt::Display for WeightedError { implementation
447 WeightedError::NoItem => write!(f, "No weights provided."), in fmt()
448 WeightedError::InvalidWeight => write!(f, "A weight is invalid."), in fmt()
449 WeightedError::AllWeightsZero => write!(f, "All weights are zero."), in fmt()
450 WeightedError::TooMany => write!(f, "Too many weights (hit u32::MAX)"), in fmt()