Skip to main content

LinearScan

Struct LinearScan 

Source
pub struct LinearScan<S> { /* private fields */ }
Expand description

Checks every stored state on each query: O(n) per query, no preprocessing.

Exact for any metric and fine for a few thousand nodes. Use a spatial index for more.

Trait Implementations§

Source§

impl<S: Clone> Clone for LinearScan<S>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<S: Debug> Debug for LinearScan<S>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<S> Default for LinearScan<S>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<Sp: StateSpace> NearestNeighbors<Sp> for LinearScan<Sp::State>

Source§

fn insert(&mut self, id: usize, state: Sp::State)

Adds a node with the given id.
Source§

fn nearest(&self, space: &Sp, query: &Sp::State) -> Option<usize>

The id of the node closest to query, or None if the structure is empty.
Source§

fn within_radius( &self, space: &Sp, query: &Sp::State, radius: f64, out: &mut Vec<usize>, )

Replaces the contents of out with the ids of all nodes within radius of query, in insertion order.
Source§

fn k_nearest( &self, space: &Sp, query: &Sp::State, k: usize, out: &mut Vec<usize>, )

Replaces the contents of out with the ids of the k nodes closest to query, closest first. Read more
Source§

fn len(&self) -> usize

The number of stored nodes.
Source§

fn is_empty(&self) -> bool

Whether no node is stored.
Source§

impl<Sp: StateSpace> RemovableNeighbors<Sp> for LinearScan<Sp::State>

Source§

fn remove(&mut self, id: usize) -> bool

Removes the node with id in O(n), keeping the insertion order of the rest.

Auto Trait Implementations§

§

impl<S> Forget for LinearScan<S>

§

impl<S> Freeze for LinearScan<S>
where Vec<(usize, S)>: Freeze,

§

impl<S> Move for LinearScan<S>

§

impl<S> RefUnwindSafe for LinearScan<S>
where Vec<(usize, S)>: RefUnwindSafe,

§

impl<S> Send for LinearScan<S>
where Vec<(usize, S)>: Send,

§

impl<S> Sync for LinearScan<S>
where Vec<(usize, S)>: Sync,

§

impl<S> Unpin for LinearScan<S>
where Vec<(usize, S)>: Unpin,

§

impl<S> UnsafeUnpin for LinearScan<S>
where Vec<(usize, S)>: UnsafeUnpin,

§

impl<S> UnwindSafe for LinearScan<S>
where Vec<(usize, S)>: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.