# [−][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.

## Blanket Implementations

### 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> Same<T> for T

#### type Output = T

Should always be Self