pub struct RandomAvailable;Expand description
Picks a random available candidate.
Only available with the rand feature.
§Example
use bubbles::saliency::{Candidate, RandomAvailable, SaliencyStrategy};
let mut s = RandomAvailable;
let candidates = vec![
Candidate { id: "a", available: false },
Candidate { id: "b", available: true },
Candidate { id: "c", available: true },
];
let idx = s.select(&candidates);
assert!(idx == Some(1) || idx == Some(2));Trait Implementations§
Source§impl Clone for RandomAvailable
impl Clone for RandomAvailable
Source§fn clone(&self) -> RandomAvailable
fn clone(&self) -> RandomAvailable
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RandomAvailable
impl Debug for RandomAvailable
Source§impl Default for RandomAvailable
impl Default for RandomAvailable
Source§fn default() -> RandomAvailable
fn default() -> RandomAvailable
Returns the “default value” for a type. Read more
Source§impl SaliencyStrategy for RandomAvailable
impl SaliencyStrategy for RandomAvailable
Auto Trait Implementations§
impl Freeze for RandomAvailable
impl RefUnwindSafe for RandomAvailable
impl Send for RandomAvailable
impl Sync for RandomAvailable
impl Unpin for RandomAvailable
impl UnsafeUnpin for RandomAvailable
impl UnwindSafe for RandomAvailable
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