pub enum DensePermutationDefect {
Duplicate {
index: usize,
slot: usize,
},
Sparse {
index: usize,
slot: usize,
},
LengthMismatch {
resolved: usize,
expected: usize,
},
}Expand description
The first way a sorted index slice fails to be a dense permutation of
0..expected_len. Distinguishing these lets callers emit a remediation that
names the actual defect (a duplicate aliases two descriptors onto one logical
slot; a sparse map skips one; a length mismatch has the wrong cardinality)
instead of a generic “not dense”.
Variants§
Duplicate
After sorting, index sits at slot with index < slot: a value
repeated earlier, so two descriptors alias one logical slot.
Fields
Sparse
After sorting, index sits at slot with index > slot: a gap, so a
logical slot in 0..expected_len is never mapped.
Fields
LengthMismatch
Every present index was dense but the cardinality is wrong (the map is
truncated or over-long relative to expected_len).
Trait Implementations§
Source§impl Clone for DensePermutationDefect
impl Clone for DensePermutationDefect
Source§fn clone(&self) -> DensePermutationDefect
fn clone(&self) -> DensePermutationDefect
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for DensePermutationDefect
Source§impl Debug for DensePermutationDefect
impl Debug for DensePermutationDefect
impl Eq for DensePermutationDefect
Source§impl PartialEq for DensePermutationDefect
impl PartialEq for DensePermutationDefect
Source§fn eq(&self, other: &DensePermutationDefect) -> bool
fn eq(&self, other: &DensePermutationDefect) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for DensePermutationDefect
Auto Trait Implementations§
impl Freeze for DensePermutationDefect
impl RefUnwindSafe for DensePermutationDefect
impl Send for DensePermutationDefect
impl Sync for DensePermutationDefect
impl Unpin for DensePermutationDefect
impl UnsafeUnpin for DensePermutationDefect
impl UnwindSafe for DensePermutationDefect
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<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
Compare self to
key and return true if they are equal.