pub struct OrderedNames { /* private fields */ }Expand description
A set of entity NAMES that remembers the order they were ADDED in — the selection’s pick order.
The selection used to be a plain HashSet, so which of two picked faces
came out first was the hash seed’s choice and differed between processes.
That is not cosmetic: an assembly Distance takes element 0 as its BASE face,
whose outward normal gives the value its sign and the arrow its direction,
so the same two picks could seed opposite constraints in two runs. Every
reader of the selection — [EngineState::selection_json], the context bar’s
feature offers, the constraint seeder — now sees the picks in the order they
were made.
insert appends, and a name already in the set keeps its
place; remove keeps the rest in order. Toggling a name off
and on therefore moves it to the END, which is where a re-pick belongs.
Membership rides in a HashSet beside the order, because contains is
called for every face and every edge of every solid, every frame, by the
emphasis colour feed.
Implementations§
Source§impl OrderedNames
impl OrderedNames
Sourcepub fn insert(&mut self, name: String) -> bool
pub fn insert(&mut self, name: String) -> bool
Add name at the END. Returns whether it was not already there (the
HashSet::insert contract), and an already-present name does NOT move.
Sourcepub fn remove(&mut self, name: &str) -> bool
pub fn remove(&mut self, name: &str) -> bool
Drop name, keeping the order of everything else. Returns whether it
was there (the HashSet::remove contract).
pub fn contains(&self, name: &str) -> bool
pub fn clear(&mut self)
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl Clone for OrderedNames
impl Clone for OrderedNames
Source§impl Debug for OrderedNames
impl Debug for OrderedNames
Source§impl Default for OrderedNames
impl Default for OrderedNames
impl Eq for OrderedNames
Source§impl Extend<String> for OrderedNames
impl Extend<String> for OrderedNames
Source§fn extend<I: IntoIterator<Item = String>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = String>>(&mut self, iter: I)
Source§fn extend_one(&mut self, item: T)
fn extend_one(&mut self, item: T)
extend_one)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)Source§impl FromIterator<String> for OrderedNames
impl FromIterator<String> for OrderedNames
Source§impl<'a> IntoIterator for &'a OrderedNames
impl<'a> IntoIterator for &'a OrderedNames
Source§impl PartialEq for OrderedNames
impl PartialEq for OrderedNames
impl StructuralPartialEq for OrderedNames
Auto Trait Implementations§
impl Freeze for OrderedNames
impl RefUnwindSafe for OrderedNames
impl Send for OrderedNames
impl Sync for OrderedNames
impl Unpin for OrderedNames
impl UnsafeUnpin for OrderedNames
impl UnwindSafe for OrderedNames
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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> ⓘ
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> ⓘ
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 more