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§

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§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.