IndexSet1

Type Alias IndexSet1 

Source
pub type IndexSet1<T, S = RandomState> = NonEmpty<IndexSet<T, S>>;
Available on crate features indexmap and std only.

Aliased Type§

pub struct IndexSet1<T, S = RandomState> { /* private fields */ }

Implementations§

Source§

impl<T, S> IndexSet1<T, S>

Source

pub unsafe fn from_index_set_unchecked(items: IndexSet<T, S>) -> Self

§Safety

items must be non-empty. For example, it is unsound to call this function with the immediate output of IndexSet::new().

Source

pub fn try_from_ref( items: &IndexSet<T, S>, ) -> Result<&Self, EmptyError<&IndexSet<T, S>>>

Source

pub fn try_from_mut( items: &mut IndexSet<T, S>, ) -> Result<&mut Self, EmptyError<&mut IndexSet<T, S>>>

Source

pub fn into_index_set(self) -> IndexSet<T, S>

Source

pub fn into_boxed_slice1(self) -> Box<Slice1<T>>

Source

pub fn reserve(&mut self, additional: usize)

Source

pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError>

Source

pub fn reserve_exact(&mut self, additional: usize)

Source

pub fn try_reserve_exact( &mut self, additional: usize, ) -> Result<(), TryReserveError>

Source

pub fn shrink_to(&mut self, capacity: usize)

Source

pub fn shrink_to_fit(&mut self)

Source

pub fn sort(&mut self)
where T: Ord,

Source

pub fn sort_by<F>(&mut self, f: F)
where F: FnMut(&T, &T) -> Ordering,

Source

pub fn sorted_by<F>(self, f: F) -> Iterator1<IntoIter<T>>
where F: FnMut(&T, &T) -> Ordering,

Source

pub fn sort_unstable(&mut self)
where T: Ord,

Source

pub fn sort_unstable_by<F>(&mut self, f: F)
where F: FnMut(&T, &T) -> Ordering,

Source

pub fn sorted_unstable_by<F>(self, f: F) -> Iterator1<IntoIter<T>>
where F: FnMut(&T, &T) -> Ordering,

Source

pub fn sort_by_cached_key<K, F>(&mut self, f: F)
where K: Ord, F: FnMut(&T) -> K,

Source

pub fn reverse(&mut self)

Source

pub fn split_off_tail(&mut self) -> IndexSet<T, S>
where S: Clone,

Source

pub fn move_index(&mut self, from: usize, to: usize)

Source

pub fn swap_indices(&mut self, a: usize, b: usize)

Source

pub fn pop_if_many(&mut self) -> PopIfMany<'_, Self>
where T: Eq + Hash,

Source

pub fn shift_remove_index_if_many( &mut self, index: usize, ) -> TakeRemoveIfMany<'_, Self>

Source

pub fn swap_remove_index_if_many( &mut self, index: usize, ) -> TakeRemoveIfMany<'_, Self>

Source

pub fn get_index(&self, index: usize) -> Option<&T>

Source

pub fn get_range<R>(&self, range: R) -> Option<&Slice<T>>
where R: RangeBounds<usize>,

Source

pub fn binary_search_by<'a, F>(&'a self, f: F) -> Result<usize, usize>
where F: FnMut(&'a T) -> Ordering,

Source

pub fn binary_search_by_key<'a, K, F>( &'a self, key: &K, f: F, ) -> Result<usize, usize>
where K: Ord, F: FnMut(&'a T) -> K,

Source

pub fn partition_point<F>(&self, f: F) -> usize
where F: FnMut(&T) -> bool,

Source

pub fn first(&self) -> &T

Source

pub fn last(&self) -> &T

Source

pub fn len(&self) -> NonZeroUsize

Source

pub fn capacity(&self) -> NonZeroUsize

Source

pub fn iter1(&self) -> Iterator1<Iter<'_, T>>

Source

pub fn hasher(&self) -> &S

Source

pub const fn as_index_set(&self) -> &IndexSet<T, S>

Source

pub const unsafe fn as_mut_index_set(&mut self) -> &mut IndexSet<T, S>

§Safety

The IndexSet behind the returned mutable reference must not be empty when the reference is dropped. Consider the following example:

use mitsein::index_set1::IndexSet1;

let mut xs = IndexSet1::from([0i32, 1, 2, 3]);
// This block is unsound. The `&mut IndexSet` is dropped in the block and so `xs` can be
// freely manipulated after the block despite violation of the non-empty guarantee.
unsafe {
    xs.as_mut_index_set().clear();
}
let x = xs.first(); // Undefined behavior!
Source

pub fn as_slice1(&self) -> &Slice1<T>

Source§

impl<T, S> IndexSet1<T, S>
where S: BuildHasher,

Source

pub fn get<Q>(&self, query: &Q) -> Option<&T>
where T: Borrow<Q>, Q: Equivalent<T> + Hash + ?Sized,

Source

pub fn shift_remove_if_many<'a, 'q, Q>( &'a mut self, query: &'q Q, ) -> DropRemoveIfMany<'a, 'q, Self, Q>
where T: Borrow<Q>, Q: Equivalent<T> + Hash + ?Sized,

Source

pub fn swap_remove_if_many<'a, 'q, Q>( &'a mut self, query: &'q Q, ) -> DropRemoveIfMany<'a, 'q, Self, Q>
where T: Borrow<Q>, Q: Equivalent<T> + Hash + ?Sized,

Source

pub fn shift_remove_full_if_many<'a, 'q, Q>( &'a mut self, query: &'q Q, ) -> TakeRemoveFullIfMany<'a, 'q, Self, Q>
where T: Borrow<Q>, Q: Equivalent<T> + Hash + ?Sized,

Source

pub fn swap_remove_full_if_many<'a, 'q, Q>( &'a mut self, query: &'q Q, ) -> TakeRemoveFullIfMany<'a, 'q, Self, Q>
where T: Borrow<Q>, Q: Equivalent<T> + Hash + ?Sized,

Source

pub fn shift_take_if_many<'a, 'q, Q>( &'a mut self, query: &'q Q, ) -> TakeRemoveIfMany<'a, Self, &'q Q>
where T: Borrow<Q>, Q: Equivalent<T> + Hash + ?Sized,

Source

pub fn swap_take_if_many<'a, 'q, Q>( &'a mut self, query: &'q Q, ) -> TakeRemoveIfMany<'a, Self, &'q Q>
where T: Borrow<Q>, Q: Equivalent<T> + Hash + ?Sized,

Source

pub fn contains<Q>(&self, item: &Q) -> bool
where T: Borrow<Q>, Q: Equivalent<T> + Hash + ?Sized,

Source§

impl<T, S> IndexSet1<T, S>
where T: Eq + Hash, S: BuildHasher,

Source

pub fn from_one(item: T) -> Self
where S: Default,

Source

pub fn from_one_with_hasher(item: T, hasher: S) -> Self

Source

pub fn from_iter1_with_hasher<U>(items: U, hasher: S) -> Self
where U: IntoIterator1<Item = T>,

Source

pub fn from_head_and_tail<I>(head: T, tail: I) -> Self
where S: Default, I: IntoIterator<Item = T>,

Source

pub fn from_rtail_and_head<I>(tail: I, head: T) -> Self
where S: Default, I: IntoIterator<Item = T>,

Source

pub fn append<SR>(&mut self, items: &mut IndexSet<T, SR>)

Source

pub fn insert(&mut self, item: T) -> bool

Source

pub fn insert_full(&mut self, item: T) -> (usize, bool)

Source

pub fn insert_sorted(&mut self, item: T) -> (usize, bool)
where T: Ord,

Source

pub fn replace(&mut self, item: T) -> Option<T>

Source

pub fn replace_full(&mut self, item: T) -> (usize, Option<T>)

Source

pub fn difference<'a, R, SR>(&'a self, other: &'a R) -> Difference<'a, T, SR>
where R: ClosedIndexSet<Item = T, State = SR>, SR: BuildHasher,

Source

pub fn symmetric_difference<'a, R, SR>( &'a self, other: &'a R, ) -> SymmetricDifference<'a, T, S, SR>
where R: ClosedIndexSet<Item = T, State = SR>, SR: BuildHasher,

Source

pub fn intersection<'a, R, SR>( &'a self, other: &'a R, ) -> Intersection<'a, T, SR>
where R: ClosedIndexSet<Item = T, State = SR>, SR: BuildHasher,

Source

pub fn union<'a, R, SR>(&'a self, other: &'a R) -> Iterator1<Union<'a, T, S>>
where R: ClosedIndexSet<Item = T, State = SR>, SR: 'a + BuildHasher,

Source

pub fn is_disjoint<R, SR>(&self, other: &R) -> bool
where R: ClosedIndexSet<Item = T, State = SR>, SR: BuildHasher,

Source

pub fn is_subset<R, SR>(&self, other: &R) -> bool
where R: ClosedIndexSet<Item = T, State = SR>, SR: BuildHasher,

Source

pub fn is_superset<R, SR>(&self, other: &R) -> bool
where R: ClosedIndexSet<Item = T, State = SR>, SR: BuildHasher,

Source§

impl<T, S> IndexSet1<T, S>

Source

pub fn par_iter1( &self, ) -> ParallelIterator1<<&Self as IntoParallelIterator>::Iter>
where T: Sync, S: Sync,

Available on crate feature rayon only.
Source§

impl<T, S> IndexSet1<T, S>
where T: Eq + Hash + Sync, S: BuildHasher + Sync,

Source

pub fn par_difference<'a, R, SR>( &'a self, other: &'a R, ) -> ParDifference<'a, T, S, SR>
where R: ClosedIndexSet<Item = T, State = SR>, SR: BuildHasher + Sync,

Available on crate feature rayon only.
Source

pub fn par_symmetric_difference<'a, R, SR>( &'a self, other: &'a R, ) -> ParSymmetricDifference<'a, T, S, SR>
where R: ClosedIndexSet<Item = T, State = SR>, SR: BuildHasher + Sync,

Available on crate feature rayon only.
Source

pub fn par_intersection<'a, R, SR>( &'a self, other: &'a R, ) -> ParIntersection<'a, T, S, SR>
where R: ClosedIndexSet<Item = T, State = SR>, SR: BuildHasher + Sync,

Available on crate feature rayon only.
Source

pub fn par_union<'a, R, SR>( &'a self, other: &'a R, ) -> ParallelIterator1<ParUnion<'a, T, S, SR>>
where R: ClosedIndexSet<Item = T, State = SR>, SR: 'a + BuildHasher + Sync,

Available on crate feature rayon only.
Source

pub fn par_eq<R, SR>(&self, other: &R) -> bool
where R: ClosedIndexSet<Item = T, State = SR>, SR: BuildHasher + Sync,

Available on crate feature rayon only.
Source

pub fn par_is_disjoint<R, SR>(&self, other: &R) -> bool
where R: ClosedIndexSet<Item = T, State = SR>, SR: BuildHasher + Sync,

Available on crate feature rayon only.
Source

pub fn par_is_subset<R, SR>(&self, other: &R) -> bool
where R: ClosedIndexSet<Item = T, State = SR>, SR: BuildHasher + Sync,

Available on crate feature rayon only.
Source

pub fn par_is_superset<R, SR>(&self, other: &R) -> bool
where R: ClosedIndexSet<Item = T, State = SR>, SR: BuildHasher + Sync,

Available on crate feature rayon only.
Source§

impl<T, S> IndexSet1<T, S>
where T: Eq + Hash + Send + Sync, S: BuildHasher + Sync,

Source

pub fn par_sort(&mut self)
where T: Ord,

Available on crate feature rayon only.
Source

pub fn par_sort_by<F>(&mut self, f: F)
where F: Fn(&T, &T) -> Ordering + Sync,

Available on crate feature rayon only.
Source

pub fn par_sorted_by<F>(self, f: F) -> ParallelIterator1<IntoParIter<T>>
where F: Fn(&T, &T) -> Ordering + Sync,

Available on crate feature rayon only.
Source

pub fn par_sort_unstable(&mut self)
where T: Ord,

Available on crate feature rayon only.
Source

pub fn par_sort_unstable_by<F>(&mut self, f: F)
where F: Fn(&T, &T) -> Ordering + Sync,

Available on crate feature rayon only.
Source

pub fn par_sorted_unstable_by<F>( self, f: F, ) -> ParallelIterator1<IntoParIter<T>>
where F: Fn(&T, &T) -> Ordering + Sync,

Available on crate feature rayon only.
Source

pub fn par_sort_by_cached_key<K, F>(&mut self, f: F)
where K: Ord + Send, F: Fn(&T) -> K + Sync,

Available on crate feature rayon only.
Source§

impl<T> IndexSet1<T, RandomState>
where T: Eq + Hash,

Source

pub fn from_one_with_capacity(item: T, capacity: usize) -> Self

Source

pub fn from_iter1_with_capacity<U>(items: U, capacity: usize) -> Self
where U: IntoIterator1<Item = T>,

Trait Implementations§

Source§

impl<'a, T> Arbitrary<'a> for IndexSet1<T>
where T: Arbitrary<'a> + Eq + Hash,

Available on crate feature arbitrary only.
Source§

fn arbitrary(unstructured: &mut Unstructured<'a>) -> Result<Self>

Generate an arbitrary value of Self from the given unstructured data. Read more
Source§

fn size_hint(depth: usize) -> (usize, Option<usize>)

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
Source§

fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more
Source§

fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
Source§

impl<R, T, S> BitAnd<&R> for &IndexSet1<T, S>
where R: ClosedIndexSet<Item = T>, R::State: BuildHasher, T: Clone + Eq + Hash, S: BuildHasher + Default,

Source§

type Output = IndexSet<T, S>

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: &R) -> Self::Output

Performs the & operation. Read more
Source§

impl<R, T, S> BitOr<&R> for &IndexSet1<T, S>
where R: ClosedIndexSet<Item = T>, R::State: BuildHasher, T: Clone + Eq + Hash, S: BuildHasher + Default,

Source§

type Output = NonEmpty<IndexSet<T, S>>

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: &R) -> Self::Output

Performs the | operation. Read more
Source§

impl<R, T, S> BitXor<&R> for &IndexSet1<T, S>
where R: ClosedIndexSet<Item = T>, R::State: BuildHasher, T: Clone + Eq + Hash, S: BuildHasher + Default,

Source§

type Output = IndexSet<T, S>

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: &R) -> Self::Output

Performs the ^ operation. Read more
Source§

impl<T, S, R> ByRange<usize, R> for IndexSet1<T, S>
where R: RangeBounds<usize>,

Source§

type Range = IndexRange

Available on crate features alloc or arrayvec or heapless only.
Source§

type Error = RangeError<usize>

Available on crate features alloc or arrayvec or heapless only.
Source§

fn segment(&mut self, range: R) -> Result<Segment<'_, Self>, Self::Error>

Available on crate features alloc or arrayvec or heapless only.
Source§

impl<T, S> ByTail for IndexSet1<T, S>

Source§

type Range = IndexRange

Available on crate features alloc or arrayvec or heapless only.
Source§

fn tail(&mut self) -> Segment<'_, Self>

Available on crate features alloc or arrayvec or heapless only.
Source§

fn rtail(&mut self) -> Segment<'_, Self>

Available on crate features alloc or arrayvec or heapless only.
Source§

impl<T, S> ClosedIndexSet for IndexSet1<T, S>

Source§

type Item = T

Source§

type State = S

Source§

fn as_index_set(&self) -> &IndexSet<Self::Item, Self::State>

Source§

impl<T, S> Debug for IndexSet1<T, S>
where T: Debug,

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T, S> Extend<T> for IndexSet1<T, S>
where T: Eq + Hash, S: BuildHasher,

Source§

fn extend<I>(&mut self, extension: I)
where I: IntoIterator<Item = T>,

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<T, const N: usize> From<[T; N]> for IndexSet1<T, RandomState>
where [T; N]: Array1, T: Eq + Hash,

Source§

fn from(items: [T; N]) -> Self

Converts to this type from the input type.
Source§

impl<T, S> FromIterator1<T> for IndexSet1<T, S>
where T: Eq + Hash, S: BuildHasher + Default,

Source§

fn from_iter1<I>(items: I) -> Self
where I: IntoIterator1<Item = T>,

Source§

fn try_from_iter<I>(items: I) -> Result<Self, EmptyError<Peekable<I::IntoIter>>>
where Self: Sized, I: IntoIterator<Item = T>,

Source§

impl<T, S> FromParallelIterator1<T> for IndexSet1<T, S>
where T: Eq + Hash + Send, S: BuildHasher + Default + Send,

Available on crate feature rayon only.
Source§

fn from_par_iter1<I>(items: I) -> Self
where I: IntoParallelIterator1<Item = T>,

Source§

impl<'a, T, S> IntoIterator for &'a IndexSet1<T, S>

Source§

type Item = &'a T

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'a, T>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<T, S> IntoIterator for IndexSet1<T, S>

Source§

type Item = T

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<T>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<T, S> IntoIterator1 for &IndexSet1<T, S>

Source§

impl<T, S> IntoIterator1 for IndexSet1<T, S>

Source§

impl<'a, T, S> IntoParallelIterator for &'a IndexSet1<T, S>
where T: Sync, S: Sync,

Available on crate feature rayon only.
Source§

type Item = &'a T

The type of item that the parallel iterator will produce.
Source§

type Iter = <&'a IndexSet<T, S> as IntoParallelIterator>::Iter

The parallel iterator type that will be created.
Source§

fn into_par_iter(self) -> Self::Iter

Converts self into a parallel iterator. Read more
Source§

impl<T, S> IntoParallelIterator for IndexSet1<T, S>
where T: Send, S: Send,

Available on crate feature rayon only.
Source§

type Item = T

The type of item that the parallel iterator will produce.
Source§

type Iter = IntoParIter<T>

The parallel iterator type that will be created.
Source§

fn into_par_iter(self) -> Self::Iter

Converts self into a parallel iterator. Read more
Source§

impl<T, S> IntoParallelIterator1 for &IndexSet1<T, S>
where T: Sync, S: Sync,

Available on crate feature rayon only.
Source§

impl<T, S> IntoParallelIterator1 for IndexSet1<T, S>
where T: Send, S: Send,

Available on crate feature rayon only.
Source§

impl<T, S> JsonSchema for IndexSet1<T, S>
where T: JsonSchema,

Available on crate feature schemars only.
Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

impl<T, S> Segmentation for IndexSet1<T, S>

Source§

type Kind = NonEmpty<IndexSet<T, S>>

Available on crate features alloc or arrayvec or heapless only.
Source§

type Target = IndexSet<T, S>

Available on crate features alloc or arrayvec or heapless only.
Source§

impl<R, T, S> Sub<&R> for &IndexSet1<T, S>
where R: ClosedIndexSet<Item = T>, R::State: BuildHasher, T: Clone + Eq + Hash, S: BuildHasher + Default,

Source§

type Output = IndexSet<T, S>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &R) -> Self::Output

Performs the - operation. Read more
Source§

impl<'a, T, S> TryFrom<&'a IndexSet<T, S>> for &'a IndexSet1<T, S>

Source§

type Error = EmptyError<&'a IndexSet<T, S>>

The type returned in the event of a conversion error.
Source§

fn try_from(items: &'a IndexSet<T, S>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a, T, S> TryFrom<&'a mut IndexSet<T, S>> for &'a mut IndexSet1<T, S>

Source§

type Error = EmptyError<&'a mut IndexSet<T, S>>

The type returned in the event of a conversion error.
Source§

fn try_from(items: &'a mut IndexSet<T, S>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<T, S> TryFrom<IndexSet<T, S>> for IndexSet1<T, S>

Source§

type Error = EmptyError<IndexSet<T, S>>

The type returned in the event of a conversion error.
Source§

fn try_from(items: IndexSet<T, S>) -> Result<Self, Self::Error>

Performs the conversion.