Skip to main content

BiMap

Struct BiMap 

Source
pub struct BiMap<L, R> { /* private fields */ }

Implementations§

Source§

impl<L, R> BiMap<L, R>
where L: Eq + Hash, R: Eq + Hash,

Source

pub fn new() -> BiMap<L, R>

Source

pub fn with_capacity(capacity: usize) -> BiMap<L, R>

Source

pub fn get_by_left<Q>(&self, left: &Q) -> Option<&R>
where L: Borrow<Q>, Q: Eq + Hash + ?Sized,

Source

pub fn get_by_right<Q>(&self, right: &Q) -> Option<&L>
where R: Borrow<Q>, Q: Eq + Hash + ?Sized,

Source

pub fn contains_left<Q>(&self, left: &Q) -> bool
where L: Borrow<Q>, Q: Eq + Hash + ?Sized,

Source

pub fn contains_right<Q>(&self, right: &Q) -> bool
where R: Borrow<Q>, Q: Eq + Hash + ?Sized,

Source

pub fn remove_by_left<Q>(&mut self, left: &Q) -> Option<(L, R)>
where L: Borrow<Q>, Q: Eq + Hash + ?Sized,

Source

pub fn remove_by_right<Q>(&mut self, right: &Q) -> Option<(L, R)>
where R: Borrow<Q>, Q: Eq + Hash + ?Sized,

Source

pub fn insert(&mut self, left: L, right: R) -> Overwritten<L, R>

Source

pub fn insert_no_overwrite(&mut self, left: L, right: R) -> Result<(), (L, R)>

Source

pub fn retain<F>(&mut self, f: F)
where F: FnMut(&L, &R) -> bool,

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn clear(&mut self)

Source

pub fn iter(&self) -> Iter<'_, L, R>

Source

pub fn left_values(&self) -> LeftValues<'_, L, R>

Source

pub fn right_values(&self) -> RightValues<'_, L, R>

Trait Implementations§

Source§

impl<L, R> Clone for BiMap<L, R>
where L: Clone + Eq + Hash, R: Clone + Eq + Hash,

Source§

fn clone(&self) -> BiMap<L, R>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<L, R> Debug for BiMap<L, R>
where L: Debug, R: Debug,

Source§

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

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

impl<L, R> Default for BiMap<L, R>
where L: Default + Eq + Hash, R: Default + Eq + Hash,

Source§

fn default() -> BiMap<L, R>

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

impl<'de, L, R> Deserialize<'de> for BiMap<L, R>
where L: Eq + Hash + Deserialize<'de>, R: Eq + Hash + Deserialize<'de>,

Source§

fn deserialize<D>( deserializer: D, ) -> Result<BiMap<L, R>, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

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

impl<'de, L, R, LAs, RAs> DeserializeAs<'de, BiMap<L, R>> for BiMap<LAs, RAs>
where L: Eq + Hash + Deserialize<'de>, R: Eq + Hash, LAs: DeserializeAs<'de, L>, RAs: DeserializeAs<'de, R>,

Source§

fn deserialize_as<D>( deserializer: D, ) -> Result<BiMap<L, R>, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer.
Source§

impl<L, R> Eq for BiMap<L, R>
where L: Eq + Hash, R: Eq + Hash,

Source§

impl<L, R, const N: usize> From<[(L, R); N]> for BiMap<L, R>
where L: Eq + Hash, R: Eq + Hash,

Source§

fn from(v: [(L, R); N]) -> BiMap<L, R>

Converts to this type from the input type.
Source§

impl<L, R> FromIterator<(L, R)> for BiMap<L, R>
where L: Eq + Hash, R: Eq + Hash,

Source§

fn from_iter<T>(iter: T) -> BiMap<L, R>
where T: IntoIterator<Item = (L, R)>,

Creates a value from an iterator. Read more
Source§

impl<L, R, NewL> FuncMap<L, NewL> for BiMap<L, R>
where L: Eq + Hash, R: Eq + Hash, NewL: Eq + Hash,

Source§

type Output = BiMap<NewL, R>

The output type of the functorial mapping Read more
Source§

fn func_map<F>(self, f: F) -> <BiMap<L, R> as FuncMap<L, NewL>>::Output
where F: FnMut(L) -> NewL,

Applies the closure f to self in a functorial way
§

fn func_map_over<Q, F>(self, f: F) -> Self::Output
where F: FnMut(A) -> B, Q: FuncMarker<P>,

Applies the closure f to self in a functorial way, allowing explicit specification of the marker type P Read more
Source§

impl<L, R, NewR> FuncMap<R, NewR, TypeParam<1>> for BiMap<L, R>
where L: Eq + Hash, R: Eq + Hash, NewR: Eq + Hash,

Source§

type Output = BiMap<L, NewR>

The output type of the functorial mapping Read more
Source§

fn func_map<F>( self, f: F, ) -> <BiMap<L, R> as FuncMap<R, NewR, TypeParam<1>>>::Output
where F: FnMut(R) -> NewR,

Applies the closure f to self in a functorial way
§

fn func_map_over<Q, F>(self, f: F) -> Self::Output
where F: FnMut(A) -> B, Q: FuncMarker<P>,

Applies the closure f to self in a functorial way, allowing explicit specification of the marker type P Read more
Source§

impl<L, R> IntoIterator for BiMap<L, R>
where L: Eq + Hash, R: Eq + Hash,

Source§

type Item = (L, R)

The type of the elements being iterated over.
Source§

type IntoIter = <BiHashMap<L, R> as IntoIterator>::IntoIter

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

fn into_iter(self) -> <BiMap<L, R> as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
Source§

impl<L, R> PartialEq for BiMap<L, R>
where L: Eq + Hash, R: Eq + Hash,

Source§

fn eq(&self, other: &BiMap<L, R>) -> bool

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

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

Inequality operator !=. Read more
Source§

impl<L, R> Quine for BiMap<L, R>
where L: Quine + Eq + Hash, R: Quine + Eq + Hash,

Source§

impl<L, R> Serialize for BiMap<L, R>
where L: Eq + Hash + Serialize, R: Eq + Hash + Serialize,

Source§

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

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

impl<L, R, LAs, RAs> SerializeAs<BiMap<L, R>> for BiMap<LAs, RAs>
where L: Eq + Hash + Serialize, R: Eq + Hash, LAs: SerializeAs<L>, RAs: SerializeAs<R>,

Source§

fn serialize_as<S>( source: &BiMap<L, R>, serializer: S, ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer,

Serialize this value into the given Serde serializer.
Source§

impl<L, R, NewL> TryFuncMap<L, NewL> for BiMap<L, R>
where L: Eq + Hash, R: Eq + Hash, NewL: Eq + Hash,

Source§

type Output = BiMap<NewL, R>

The output type of the functorial mapping Read more
Source§

fn try_func_map<E, F>( self, f: F, ) -> Result<<BiMap<L, R> as TryFuncMap<L, NewL>>::Output, E>
where F: FnMut(L) -> Result<NewL, E>,

Tries to apply the closure f to self in a functorial way Read more
§

fn try_func_map_over<Q, E, F>(self, f: F) -> Result<Self::Output, E>
where F: FnMut(A) -> Result<B, E>, Q: FuncMarker<P>,

Tries to apply the closure f to self in a functorial way, allowing explicit specification of the marker type P Read more
Source§

impl<L, R, NewR> TryFuncMap<R, NewR, TypeParam<1>> for BiMap<L, R>
where L: Eq + Hash, R: Eq + Hash, NewR: Eq + Hash,

Source§

type Output = BiMap<L, NewR>

The output type of the functorial mapping Read more
Source§

fn try_func_map<E, F>( self, f: F, ) -> Result<<BiMap<L, R> as TryFuncMap<R, NewR, TypeParam<1>>>::Output, E>
where F: FnMut(R) -> Result<NewR, E>,

Tries to apply the closure f to self in a functorial way Read more
§

fn try_func_map_over<Q, E, F>(self, f: F) -> Result<Self::Output, E>
where F: FnMut(A) -> Result<B, E>, Q: FuncMarker<P>,

Tries to apply the closure f to self in a functorial way, allowing explicit specification of the marker type P Read more

Auto Trait Implementations§

§

impl<L, R> Freeze for BiMap<L, R>
where BiHashMap<L, R>: Freeze,

§

impl<L, R> RefUnwindSafe for BiMap<L, R>
where BiHashMap<L, R>: RefUnwindSafe,

§

impl<L, R> Send for BiMap<L, R>
where BiHashMap<L, R>: Send,

§

impl<L, R> Sync for BiMap<L, R>
where BiHashMap<L, R>: Sync,

§

impl<L, R> Unpin for BiMap<L, R>
where BiHashMap<L, R>: Unpin,

§

impl<L, R> UnsafeUnpin for BiMap<L, R>
where BiHashMap<L, R>: UnsafeUnpin,

§

impl<L, R> UnwindSafe for BiMap<L, R>
where BiHashMap<L, R>: 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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

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

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

§

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.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<I> IWLitIter for I
where I: IntoIterator<Item = (Lit, isize)>,

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.

§

impl<T, A> IntoAst<A> for T
where T: Into<A>, A: Ast,

§

fn into_ast(self, _a: &A) -> A

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<I> IntoStreamingIterator for I
where I: IntoIterator,

Source§

fn into_streaming_iter(self) -> Convert<Self::IntoIter>

Source§

fn into_streaming_iter_ref<'a, T>(self) -> ConvertRef<'a, Self::IntoIter, T>
where Self: IntoIterator<Item = &'a T>, T: ?Sized,

Turns an IntoIterator of references into a StreamingIterator. Read more
Source§

fn into_streaming_iter_mut<'a, T>(self) -> ConvertMut<'a, Self::IntoIter, T>
where Self: IntoIterator<Item = &'a mut T>, T: ?Sized,

Turns an IntoIterator of mutable references into a StreamingIteratorMut. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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<I> WClsIter for I
where I: IntoIterator<Item = (Clause, usize)>,

§

impl<I> WLitIter for I
where I: IntoIterator<Item = (Lit, usize)>,

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 96 bytes