Enum bimap::Overwritten
source · pub enum Overwritten<L, R> {
Neither,
Left(L, R),
Right(L, R),
Pair(L, R),
Both((L, R), (L, R)),
}
Expand description
The previous left-right pairs, if any, that were overwritten by a call to
the insert
method of a bimap.
Variants§
Neither
Neither the left nor the right value previously existed in the bimap.
Left(L, R)
The left value existed in the bimap, and the previous left-right pair is returned.
Right(L, R)
The right value existed in the bimap, and the previous left-right pair is returned.
Pair(L, R)
The left-right pair already existed in the bimap, and the previous left-right pair is returned.
Both((L, R), (L, R))
Both the left and the right value existed in the bimap, but as part of separate pairs. The first tuple is the left-right pair of the previous left value, and the second is the left-right pair of the previous right value.
Implementations§
source§impl<L, R> Overwritten<L, R>
impl<L, R> Overwritten<L, R>
sourcepub fn did_overwrite(&self) -> bool
pub fn did_overwrite(&self) -> bool
Returns a boolean indicating if the Overwritten
variant implies any
values were overwritten.
This method is true
for all variants other than Neither
.
§Examples
use bimap::{BiMap, Overwritten};
let mut bimap = BiMap::new();
assert!(!bimap.insert('a', 1).did_overwrite());
assert!(bimap.insert('a', 2).did_overwrite());
Trait Implementations§
source§impl<L: Clone, R: Clone> Clone for Overwritten<L, R>
impl<L: Clone, R: Clone> Clone for Overwritten<L, R>
source§fn clone(&self) -> Overwritten<L, R>
fn clone(&self) -> Overwritten<L, R>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<L: PartialEq, R: PartialEq> PartialEq for Overwritten<L, R>
impl<L: PartialEq, R: PartialEq> PartialEq for Overwritten<L, R>
source§fn eq(&self, other: &Overwritten<L, R>) -> bool
fn eq(&self, other: &Overwritten<L, R>) -> bool
self
and other
values to be equal, and is used
by ==
.