Skip to main content

TryIndexSet

Struct TryIndexSet 

Source
pub struct TryIndexSet<T, S = RandomState> { /* private fields */ }
Expand description

A wrapper around [indexmap::IndexSet] that only provides fallible allocation.

Implementations§

Source§

impl<T> TryIndexSet<T>

Source

pub fn new() -> Self

Same as [indexmap::IndexSet::new].

Source§

impl<T, S> TryIndexSet<T, S>

Source

pub const fn with_hasher(hash_builder: S) -> Self

Same as [indexmap::IndexSet::with_hasher].

Source

pub fn len(&self) -> usize

Same as [indexmap::IndexSet::len].

Source

pub fn is_empty(&self) -> bool

Same as [indexmap::IndexSet::is_empty].

Source

pub fn iter(&self) -> Iter<'_, T> ⓘ

Same as [indexmap::IndexSet::iter].

Source

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

Same as [indexmap::IndexSet::get_index].

Source

pub fn reserve(&mut self, additional: usize) -> Result<(), OutOfMemory>

Same as [indexmap::IndexSet::reserve] but returns an error on allocation failure.

Source§

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

Source

pub fn insert(&mut self, value: T) -> Result<bool, OutOfMemory>

Same as [indexmap::IndexSet::insert] but returns an error on allocation failure.

Source

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

Same as [indexmap::IndexSet::contains].

Source

pub fn get_index_of<Q>(&self, value: &Q) -> Option<usize>
where Q: ?Sized + Hash + Eq, T: Borrow<Q>,

Same as [indexmap::IndexSet::get_index_of].

Trait Implementations§

Source§

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

Source§

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

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

impl<T, S> Default for TryIndexSet<T, S>
where S: Default,

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de, T> Deserialize<'de> for TryIndexSet<T>
where T: Deserialize<'de> + Hash + Eq,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

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

Source§

impl<T, S> From<IndexSet<T, S>> for TryIndexSet<T, S>

Source§

fn from(inner: IndexSet<T, S>) -> Self

Converts to this type from the input type.
Source§

impl<T, S> From<TryIndexSet<T, S>> for IndexSet<T, S>

Source§

fn from(set: TryIndexSet<T, S>) -> Self

Converts to this type from the input type.
Source§

impl<T, S> Index<usize> for TryIndexSet<T, S>

Source§

type Output = T

The returned type after indexing.
Source§

fn index(&self, index: usize) -> &T

Performs the indexing (container[index]) operation. Read more
Source§

impl<'a, T, S> IntoIterator for &'a TryIndexSet<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 TryIndexSet<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> PartialEq for TryIndexSet<T, S>
where T: Eq + Hash, S: BuildHasher,

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<T, S> Serialize for TryIndexSet<T, S>
where T: Serialize,

Source§

fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error>
where Ser: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<T, S> TryClone for TryIndexSet<T, S>
where T: Eq + Hash + TryClone, S: BuildHasher + TryClone,

Source§

fn try_clone(&self) -> Result<Self, OutOfMemory>

Attempt to clone self, returning an error if any allocation fails during cloning.
§

fn clone_panic_on_oom(&self) -> Self

Clone self, panicking on allocation failure.
Source§

impl<T, E> TryFromIterator<Result<T, E>, E> for TryIndexSet<T>
where T: Hash + Eq, E: From<OutOfMemory>,

Source§

fn try_from_iter<I>(iter: I) -> Result<Self, E>
where I: Iterator<Item = Result<T, E>>,

Creates an instance of this collection from the iter provided. Read more
Source§

impl<T> TryFromIterator<T, OutOfMemory> for TryIndexSet<T>
where T: Hash + Eq,

Source§

fn try_from_iter<I>(iter: I) -> Result<Self, OutOfMemory>
where I: Iterator<Item = T>,

Creates an instance of this collection from the iter provided. Read more

Auto Trait Implementations§

§

impl<T, S> Freeze for TryIndexSet<T, S>
where IndexSet<T, S>: Freeze,

§

impl<T, S> RefUnwindSafe for TryIndexSet<T, S>
where IndexSet<T, S>: RefUnwindSafe,

§

impl<T, S> Send for TryIndexSet<T, S>
where IndexSet<T, S>: Send,

§

impl<T, S> Sync for TryIndexSet<T, S>
where IndexSet<T, S>: Sync,

§

impl<T, S> Unpin for TryIndexSet<T, S>
where IndexSet<T, S>: Unpin,

§

impl<T, S> UnsafeUnpin for TryIndexSet<T, S>
where IndexSet<T, S>: UnsafeUnpin,

§

impl<T, S> UnwindSafe for TryIndexSet<T, S>
where IndexSet<T, S>: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

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

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> TryToOwned for T
where T: TryClone,

§

type Owned = T

The owned version of this type.
§

fn try_to_owned(&self) -> Result<<T as TryToOwned>::Owned, OutOfMemory>

Try to allocate an owned version of self.