pub trait PointUpdate<P, K> {
// Required methods
fn insert(&mut self, key: K, position: P);
fn remove(&mut self, key: &K);
fn len(&self) -> usize;
fn is_empty(&self) -> bool;
fn contains_key(&self, key: &K) -> bool;
fn clear(&mut self);
}Expand description
Allow incremental updates to points in the spatial data.
Required Methods§
Sourcefn insert(&mut self, key: K, position: P)
fn insert(&mut self, key: K, position: P)
Insert or update a point identified by a key.
§Example
use hoomd_spatial::{PointUpdate, VecCell};
let mut vec_cell = VecCell::default();
vec_cell.insert(0, [1.25, 2.5].into());Sourcefn remove(&mut self, key: &K)
fn remove(&mut self, key: &K)
Remove the point with the given key.
§Example
use hoomd_spatial::{PointUpdate, VecCell};
let mut vec_cell = VecCell::default();
vec_cell.insert(0, [1.25, 2.5].into());
vec_cell.remove(&0)Sourcefn len(&self) -> usize
fn len(&self) -> usize
Get the number of points in the spatial data structure.
§Example
use hoomd_spatial::{PointUpdate, VecCell};
let mut vec_cell = VecCell::default();
vec_cell.insert(0, [1.25, 2.5].into());
assert_eq!(vec_cell.len(), 1)Sourcefn is_empty(&self) -> bool
fn is_empty(&self) -> bool
Test if the spatial data structure is empty.
§Example
use hoomd_spatial::{PointUpdate, VecCell};
let mut vec_cell = VecCell::<usize, 2>::default();
assert!(vec_cell.is_empty());Sourcefn contains_key(&self, key: &K) -> bool
fn contains_key(&self, key: &K) -> bool
Test if the spatial data structure contains a key.
use hoomd_spatial::{PointUpdate, VecCell};
let mut vec_cell = VecCell::default();
vec_cell.insert(0, [1.25, 2.5].into());
assert!(vec_cell.contains_key(&0));