Skip to main content

SpatialContainer

Trait SpatialContainer 

Source
pub trait SpatialContainer: ApproximateSpace + Sized {
    type SpatialIter<'a>: Iterator<Item = (View<'a, Self::PointProxy>, View<'a, Self::ValueProxy>)>
       where Self: 'a;

    // Required methods
    fn with_metric(metric: Self::Metric) -> Self;
    fn insert(
        &mut self,
        point: Owned<Self::PointProxy>,
        value: Owned<Self::ValueProxy>,
    );
    fn iter(&self) -> Self::SpatialIter<'_>;

    // Provided methods
    fn extend(
        &mut self,
        iter: impl IntoIterator<Item = (Owned<Self::PointProxy>, Owned<Self::ValueProxy>)>,
    ) { ... }
    fn from_metric_and_iterator(
        metric: Self::Metric,
        batch: impl IntoIterator<Item = (Owned<Self::PointProxy>, Owned<Self::ValueProxy>)>,
    ) -> Self { ... }
}
Expand description

Implement this trait on spatial containers that map points to values.

Required Associated Types§

Source

type SpatialIter<'a>: Iterator<Item = (View<'a, Self::PointProxy>, View<'a, Self::ValueProxy>)> where Self: 'a

Required Methods§

Source

fn with_metric(metric: Self::Metric) -> Self

Create a new instance of the data structure with the given metric.

Source

fn insert( &mut self, point: Owned<Self::PointProxy>, value: Owned<Self::ValueProxy>, )

Insert a (point, value) pair into a spatial data structure.

Source

fn iter(&self) -> Self::SpatialIter<'_>

Iterate over all the point, value pairs in the data structure.

Provided Methods§

Source

fn extend( &mut self, iter: impl IntoIterator<Item = (Owned<Self::PointProxy>, Owned<Self::ValueProxy>)>, )

Extend the data structure with additional data from an iterator of (point, value) pairs.

Source

fn from_metric_and_iterator( metric: Self::Metric, batch: impl IntoIterator<Item = (Owned<Self::PointProxy>, Owned<Self::ValueProxy>)>, ) -> Self

Create a new instance of the data structure with the given metric and an iterator of (point, value) pairs.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<M, P, V, PP, VP> SpatialContainer for LinearContainer<M, P, V, PP, VP>
where M: Metric<PP>, PP: ProxyView<Owned = P>, VP: ProxyView<Owned = V>,

Source§

type SpatialIter<'a> = Map<Iter<'a, (P, V)>, fn(&'a (P, V)) -> (<PP as ProxyView>::View<'a>, <VP as ProxyView>::View<'a>)> where Self: 'a