pub struct RankState { /* private fields */ }Expand description
Stability state carried between refreshes.
Implementations§
Source§impl RankState
impl RankState
pub fn new() -> Self
Sourcepub fn new_ids(&self) -> &HashSet<String>
pub fn new_ids(&self) -> &HashSet<String>
Rows that appeared on the last refresh (not counting the very first one).
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Forgets the order (next apply sorts from scratch), e.g. after a view change.
Sourcepub fn apply(
&mut self,
scored: &[(String, f64)],
selected: Option<&str>,
margin: f64,
) -> Vec<RankedRow>
pub fn apply( &mut self, scored: &[(String, f64)], selected: Option<&str>, margin: f64, ) -> Vec<RankedRow>
Applies hysteresis to this refresh’s scores:
- first call: plain score order (ties by id);
- rows that disappeared are dropped; new rows are inserted at their score position (see
new_ids); - a row climbs only after beating the row directly above it by
marginforMOVE_AFTER_REFRESHESconsecutive refreshes; it then jumps above every row it beats bymargin(not past a row that moved this refresh), and its counter restarts; selectedkeeps its index; rows arrange around it.
Trait Implementations§
impl StructuralPartialEq for RankState
Auto Trait Implementations§
impl Forget for RankState
impl Freeze for RankStatewhere
*const u8 is !null: Freeze,
PhantomData<String>: Freeze,
PhantomData<(String, u32)>: Freeze,
PhantomData<(String, ())>: Freeze,
impl Move for RankState
impl RefUnwindSafe for RankState
impl Send for RankState
impl Sync for RankState
impl Unpin for RankState
impl UnsafeUnpin for RankStatewhere
*const u8 is !null: UnsafeUnpin,
PhantomData<String>: UnsafeUnpin,
PhantomData<(String, u32)>: UnsafeUnpin,
PhantomData<(String, ())>: UnsafeUnpin,
impl UnwindSafe for RankState
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