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

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

Entity selector.

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

An index is typically used to select an adjacent entity or contained (and ordered) entity, such as an adjacent 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)

Implementations

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: Clone> Clone for Selector<K>[src]

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

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

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

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

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

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

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

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

Auto Trait Implementations

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

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

Blanket Implementations

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

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

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

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

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

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

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

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Scalar for T where
    T: PartialEq<T> + Copy + Any + Debug
[src]

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

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

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<V, T> VZip<V> for T where
    V: MultiLane<T>,