pub struct Selection<T> {
pub item: T,
pub score: f64,
pub precision: f64,
pub index: usize,
pub considered: usize,
pub passed: usize,
pub reason: Option<String>,
}Expand description
A selection result from an objective function
Fields§
§item: TThe selected item
score: f64Score of the selection
precision: f64Precision (inverse variance) of the score estimate. Default 1.0 (fully trusted).
The effective ranking score is score * precision. When precision is 1.0 (the
default), ranking is identical to raw score ordering (ADR-059).
index: usizeIndex in the original candidates
considered: usizeNumber of candidates considered
passed: usizeNumber of candidates that passed threshold
reason: Option<String>Reason for selection
Implementations§
Source§impl<T> Selection<T>
impl<T> Selection<T>
Sourcepub fn with_precision(self, precision: f64) -> Self
pub fn with_precision(self, precision: f64) -> Self
Set the precision (reliability estimate for the score).
Values in (0, 1] are typical; 1.0 means fully trusted (the default).
Sourcepub fn with_considered(self, n: usize) -> Self
pub fn with_considered(self, n: usize) -> Self
Set the considered count
Sourcepub fn with_passed(self, n: usize) -> Self
pub fn with_passed(self, n: usize) -> Self
Set the passed count
Sourcepub fn with_reason(self, reason: impl Into<String>) -> Self
pub fn with_reason(self, reason: impl Into<String>) -> Self
Set the reason
Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for Selection<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Selection<T>where
T: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl<T> Freeze for Selection<T>where
T: Freeze,
impl<T> RefUnwindSafe for Selection<T>where
T: RefUnwindSafe,
impl<T> Send for Selection<T>where
T: Send,
impl<T> Sync for Selection<T>where
T: Sync,
impl<T> Unpin for Selection<T>where
T: Unpin,
impl<T> UnsafeUnpin for Selection<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Selection<T>where
T: UnwindSafe,
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