[][src]Struct plexus::index::LruIndexer

pub struct LruIndexer<T, K> where
    T: Topological,
    K: Clone + PartialEq
{ /* fields omitted */ }

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 with_capacity.

This indexer is useful if the vertex key data cannot be hashed (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));

Methods

impl<T, K> LruIndexer<T, K> where
    T: Topological,
    K: Clone + PartialEq
[src]

pub fn new() -> Self[src]

Creates a new LruIndexer with a default capacity.

pub fn with_capacity(capacity: usize) -> Self[src]

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

impl<T, K> Indexer<T, K> for LruIndexer<T, K> where
    T: Topological,
    K: Clone + PartialEq
[src]

impl<T, K> Default for LruIndexer<T, K> where
    T: Topological,
    K: Clone + PartialEq
[src]

Auto Trait Implementations

impl<T, K> Send for LruIndexer<T, K> where
    K: Send,
    T: Send

impl<T, K> Sync for LruIndexer<T, K> where
    K: Sync,
    T: Sync

impl<T, K> Unpin for LruIndexer<T, K> where
    K: Unpin,
    T: Unpin

impl<T, K> UnwindSafe for LruIndexer<T, K> where
    K: UnwindSafe,
    T: UnwindSafe

impl<T, K> RefUnwindSafe for LruIndexer<T, K> where
    K: RefUnwindSafe,
    T: RefUnwindSafe

Blanket Implementations

impl<T> FromGeometry<T> for T[src]

impl<T, U> IntoGeometry<U> for T where
    U: FromGeometry<T>, 
[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,