pub enum Selector<K> {
ByKey(K),
ByIndex(usize),
}Expand description
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 plexus::graph::MeshGraph;
use plexus::prelude::*;
use plexus::primitive::cube::Cube;
let mut graph = Cube::new()
.polygons_with_position()
.collect::<MeshGraph<Triplet<_>>>();
let abc = graph.faces().nth(0).unwrap().key();
graph
.face_mut(abc)
.unwrap()
.split(ByIndex(0), ByIndex(2))
.unwrap();Variants§
Implementations§
Source§impl<K> Selector<K>
impl<K> Selector<K>
Sourcepub fn key_or_else<E, F>(self, f: F) -> Result<K, GraphError>
pub fn key_or_else<E, F>(self, f: F) -> Result<K, GraphError>
Gets the selector’s key or passes its index to a function to resolve the key.
Sourcepub fn index_or_else<E, F>(self, f: F) -> Result<usize, GraphError>
pub fn index_or_else<E, F>(self, f: F) -> Result<usize, GraphError>
Gets the selector’s index or passes its key to a function to resolve the index.
Trait Implementations§
impl<K: Copy> Copy for Selector<K>
impl<K: Eq> Eq for Selector<K>
impl<K> StructuralPartialEq for Selector<K>
Auto Trait Implementations§
impl<K> Freeze for Selector<K>where
K: Freeze,
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§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FromGeometry<T> for T
impl<T> FromGeometry<T> for T
fn from_geometry(other: T) -> T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T, U> IntoGeometry<U> for Twhere
U: FromGeometry<T>,
impl<T, U> IntoGeometry<U> for Twhere
U: FromGeometry<T>,
fn into_geometry(self) -> U
Source§impl<T, U> IntoInteriorGeometry<U> for Twhere
U: FromInteriorGeometry<T>,
impl<T, U> IntoInteriorGeometry<U> for Twhere
U: FromInteriorGeometry<T>,
fn into_interior_geometry(self) -> U
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§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 moreSource§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).Source§unsafe fn to_subset_unchecked(&self) -> SS
unsafe fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.