[][src]Enum plexus::graph::Selector

pub enum Selector<K> {
    ByKey(K),
    ByIndex(usize),
}

Topology selector.

Identifies topology by key or index. Keys behave as an absolute selector and uniquely identify a single topological structure. Indices behave as a relative selector and identify topological structures relative to some other structure. Selector is used by operations that support both of these selection mechanisms.

An index is typically used to select a neighbor or contained (and ordered) topological structure, such as a neighboring face.

Examples

Splitting a face by index (of its contained vertices):

use decorum::N64;
use nalgebra::Point3;
use plexus::graph::MeshGraph;
use plexus::prelude::*;
use plexus::primitive::cube::Cube;
use plexus::primitive::generate::Position;

let mut graph = Cube::new()
    .polygons::<Position<Point3<N64>>>()
    .collect::<MeshGraph<Point3<N64>>>();
let key = graph.faces().nth(0).unwrap().key();
graph
    .face_mut(key)
    .unwrap()
    .split(ByIndex(0), ByIndex(2))
    .unwrap();

Variants

ByKey(K)
ByIndex(usize)

Methods

impl<K> Selector<K>[src]

pub fn key_or_else<E, F>(self, f: F) -> Result<K, GraphError> where
    E: Into<GraphError>,
    F: Fn(usize) -> Result<K, E>, 
[src]

Gets the selector's key or passes its index to a function to resolve the key.

pub fn index_or_else<E, F>(self, f: F) -> Result<usize, GraphError> where
    E: Into<GraphError>,
    F: Fn(K) -> Result<usize, E>, 
[src]

Gets the selector's index or passes its key to a function to resolve the index.

Trait Implementations

impl<K> From<K> for Selector<K> where
    K: OpaqueKey, 
[src]

impl<K> From<usize> for Selector<K>[src]

impl<K: Clone> Clone for Selector<K>[src]

impl<K: Copy> Copy for Selector<K>[src]

impl<K: Eq> Eq for Selector<K>[src]

impl<K: PartialEq> PartialEq<Selector<K>> for Selector<K>[src]

impl<K: Debug> Debug for Selector<K>[src]

impl<K> StructuralPartialEq for Selector<K>[src]

impl<K> StructuralEq for Selector<K>[src]

Auto Trait Implementations

impl<K> Send for Selector<K> where
    K: Send

impl<K> Sync for Selector<K> where
    K: Sync

impl<K> Unpin for Selector<K> where
    K: Unpin

impl<K> UnwindSafe for Selector<K> where
    K: UnwindSafe

impl<K> RefUnwindSafe for Selector<K> where
    K: 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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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> Scalar for T where
    T: Copy + PartialEq<T> + Any + Debug
[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>, 

impl<T> Slottable for T where
    T: Copy
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]