Struct plexus::index::LruIndexer
source · [−]pub struct LruIndexer<T, K> where
T: Topological,
K: Clone + PartialEq, { /* private fields */ }
Expand description
LRU caching vertex indexer.
This indexer uses a least recently used (LRU) cache to form an index. To
function correctly, an adequate cache capacity is necessary. If the capacity
is insufficient, then redundant vertex data may be emitted. See
LruIndexer::with_capacity
.
This indexer is useful if the vertex key data does not implement Hash
.
If the key data can be hashed, prefer HashIndexer
instead.
Examples
use nalgebra::Point3;
use plexus::index::{Flat3, LruIndexer};
use plexus::prelude::*;
use plexus::primitive::generate::Position;
use plexus::primitive::sphere::UvSphere;
let (indices, positions) = UvSphere::new(8, 8)
.polygons::<Position<Point3<f64>>>()
.triangulate()
.index_vertices::<Flat3, _>(LruIndexer::with_capacity(64));
Implementations
sourceimpl<T, K> LruIndexer<T, K> where
T: Topological,
K: Clone + PartialEq,
impl<T, K> LruIndexer<T, K> where
T: Topological,
K: Clone + PartialEq,
sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Creates a new LruIndexer
with the specified capacity.
The capacity of the cache must be sufficient in order to generate a unique set of index and vertex data.
Trait Implementations
sourceimpl<T, K> Default for LruIndexer<T, K> where
T: Topological,
K: Clone + PartialEq,
impl<T, K> Default for LruIndexer<T, K> where
T: Topological,
K: Clone + PartialEq,
Auto Trait Implementations
impl<T, K> RefUnwindSafe for LruIndexer<T, K> where
K: RefUnwindSafe,
impl<T, K> Send for LruIndexer<T, K> where
K: Send,
impl<T, K> Sync for LruIndexer<T, K> where
K: Sync,
impl<T, K> Unpin for LruIndexer<T, K> where
K: Unpin,
impl<T, K> UnwindSafe for LruIndexer<T, K> where
K: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> FromGeometry<T> for T
impl<T> FromGeometry<T> for T
fn from_geometry(other: T) -> T
sourceimpl<T, U> IntoGeometry<U> for T where
U: FromGeometry<T>,
impl<T, U> IntoGeometry<U> for T where
U: FromGeometry<T>,
fn into_geometry(self) -> U
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if self
is actually part of its subset T
(and can be converted to it).
fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.