[−][src]Struct indexed_map::IndexedMap
An indexed map
TODO: replace inner
methods with full copy of HashMap
API
Methods
impl<T> IndexedMap<T>
[src]
pub fn new() -> IndexedMap<T>
[src]
Create a new `IndexedMap'
Examples
use indexed_map::IndexedMap; let mut foo = IndexedMap::new(); let bar = foo.insert("bar"); println!("{:?}", foo);
pub fn insert(&mut self, value: T) -> usize
[src]
Insert an item, creating a new unique key, and return the key
Examples
use indexed_map::IndexedMap; // create an empty `IndexedMap`, just like `HashMap` let mut fruits = IndexedMap::new(); // insert some values and store their keys for later use let apple = fruits.insert("Apple"); let orange = fruits.insert("Orange"); let pear = fruits.insert("Pear"); // list the values we've inserted for fruit in fruits.inner().values() { println!("{}", fruit); } // access using unique keys assert_eq!("Apple", *fruits.inner().get(&apple).unwrap()); assert_eq!("Orange", *fruits.inner().get(&orange).unwrap()); assert_eq!("Pear", *fruits.inner().get(&pear).unwrap());
pub fn inner(&self) -> &HashMap<usize, T>
[src]
Access the underlying HashMap
pub fn inner_mut(&mut self) -> &mut HashMap<usize, T>
[src]
Mutably access the underlying HashMap
pub fn into_inner(self) -> HashMap<usize, T>
[src]
Unwrap the IndexedMap
to return the underlying HashMap
Trait Implementations
impl<T: Clone> Clone for IndexedMap<T>
[src]
fn clone(&self) -> IndexedMap<T>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T: Debug> Debug for IndexedMap<T>
[src]
Auto Trait Implementations
impl<T> Sync for IndexedMap<T> where
T: Sync,
T: Sync,
impl<T> Send for IndexedMap<T> where
T: Send,
T: Send,
impl<T> Unpin for IndexedMap<T> where
T: Unpin,
T: Unpin,
impl<T> RefUnwindSafe for IndexedMap<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> UnwindSafe for IndexedMap<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,