Struct swifco_rs::match_candidates::MatchCandidates
source · [−]Expand description
Utility type to match T targets
against C candidates
to within buffer
using O(T log C) time and O(C) space
Each candidate will be selected for at most one target with targets being served in order.
Matching will prefer candidates closer to a target w.r.t. the max-norm and choose randomly between the best candidates.
Fields
candidates: Vec<Candidate>
all_canidates: Vec<Entity>
Implementations
sourceimpl MatchCandidates
impl MatchCandidates
pub fn new<'a>(
candidates: impl Iterator<Item = (&'a Entity, &'a Coord)>
) -> Self
fn new_impl<'a, C, S>(candidates: C) -> Self where
C: Iterator<Item = (&'a Entity, &'a Coord)>,
S: Search,
pub fn select(
&mut self,
buffer: u16,
target: Coord,
rng: &mut impl Rng
) -> (Option<Entity>, &[Entity])
fn select_impl<R, S>(
&mut self,
buffer: u16,
target: Coord,
rng: &mut R
) -> (Option<Entity>, &[Entity]) where
R: Rng,
S: Search,
Auto Trait Implementations
impl RefUnwindSafe for MatchCandidates
impl Send for MatchCandidates
impl Sync for MatchCandidates
impl Unpin for MatchCandidates
impl UnwindSafe for MatchCandidates
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more