pub struct OccupiedEntry<'map, Key, Value> { /* private fields */ }
Expand description

A view into an occupied entry in the multimap.

Implementations

Examples
use ordered_multimap::ListOrderedMultimap;
use ordered_multimap::list_ordered_multimap::Entry;

let mut map = ListOrderedMultimap::new();
map.insert("key", "value1");

let mut entry = match map.entry("key") {
    Entry::Occupied(entry) => entry,
    _ => panic!("expected occupied entry")
};

entry.append("value2");

let mut iter = map.get_all(&"key");
assert_eq!(iter.next(), Some(&"value1"));
assert_eq!(iter.next(), Some(&"value2"));
assert_eq!(iter.next(), None);
Examples
use ordered_multimap::ListOrderedMultimap;
use ordered_multimap::list_ordered_multimap::Entry;

let mut map = ListOrderedMultimap::new();
map.insert("key", "value");

let mut entry = match map.entry("key") {
    Entry::Occupied(entry) => entry,
    _ => panic!("expected occupied entry")
};

assert_eq!(entry.get(), &"value");
Examples
use ordered_multimap::ListOrderedMultimap;
use ordered_multimap::list_ordered_multimap::Entry;

let mut map = ListOrderedMultimap::new();
map.insert("key", "value");

let mut entry = match map.entry("key") {
    Entry::Occupied(entry) => entry,
    _ => panic!("expected occupied entry")
};

assert_eq!(entry.get(), &mut "value");
Examples
use ordered_multimap::ListOrderedMultimap;
use ordered_multimap::list_ordered_multimap::Entry;

let mut map = ListOrderedMultimap::new();
map.insert("key", "value1");

let mut entry = match map.entry("key") {
    Entry::Occupied(entry) => entry,
    _ => panic!("expected occupied entry")
};

entry.insert("value2");

assert_eq!(map.get(&"key"), Some(&"value2"));
Examples
use ordered_multimap::ListOrderedMultimap;
use ordered_multimap::list_ordered_multimap::Entry;

let mut map = ListOrderedMultimap::new();
map.insert("key", "value1");

let mut entry = match map.entry("key") {
    Entry::Occupied(entry) => entry,
    _ => panic!("expected occupied entry")
};

entry.append("value2");

let mut iter = entry.insert_all("value3");
assert_eq!(iter.next(), Some("value1"));
assert_eq!(iter.next(), Some("value2"));
assert_eq!(iter.next(), None);
Examples
use ordered_multimap::ListOrderedMultimap;
use ordered_multimap::list_ordered_multimap::Entry;

let mut map = ListOrderedMultimap::new();
map.insert("key", "value");

let mut entry = match map.entry("key") {
    Entry::Occupied(entry) => entry,
    _ => panic!("expected occupied entry")
};

assert_eq!(entry.into_mut(), &mut "value");
Examples
use ordered_multimap::ListOrderedMultimap;
use ordered_multimap::list_ordered_multimap::Entry;

let mut map = ListOrderedMultimap::new();
map.insert("key", "value1");

let mut entry = match map.entry("key") {
    Entry::Occupied(entry) => entry,
    _ => panic!("expected occupied entry")
};

entry.append("value2");

let mut iter = entry.iter();
assert_eq!(iter.next(), Some(&"value1"));
assert_eq!(iter.next(), Some(&"value2"));
assert_eq!(iter.next(), None);
Examples
use ordered_multimap::ListOrderedMultimap;
use ordered_multimap::list_ordered_multimap::Entry;

let mut map = ListOrderedMultimap::new();
map.insert("key", "value1");

let mut entry = match map.entry("key") {
    Entry::Occupied(entry) => entry,
    _ => panic!("expected occupied entry")
};

entry.append("value2");

let mut iter = entry.iter_mut();
assert_eq!(iter.next(), Some(&mut "value1"));
assert_eq!(iter.next(), Some(&mut "value2"));
assert_eq!(iter.next(), None);
Examples
use ordered_multimap::ListOrderedMultimap;
use ordered_multimap::list_ordered_multimap::Entry;

let mut map = ListOrderedMultimap::new();
map.insert("key", "value1");

let mut entry = match map.entry("key") {
    Entry::Occupied(entry) => entry,
    _ => panic!("expected occupied entry")
};

assert_eq!(entry.key(), &"key");
Examples
use ordered_multimap::ListOrderedMultimap;
use ordered_multimap::list_ordered_multimap::Entry;

let mut map = ListOrderedMultimap::new();
map.insert("key", "value1");

let mut entry = match map.entry("key") {
    Entry::Occupied(entry) => entry,
    _ => panic!("expected occupied entry")
};

assert_eq!(entry.len(), 1);

entry.append("value2");
assert_eq!(entry.len(), 2);
Examples
use ordered_multimap::ListOrderedMultimap;
use ordered_multimap::list_ordered_multimap::Entry;

let mut map = ListOrderedMultimap::new();
map.insert("key", "value");

let mut entry = match map.entry("key") {
    Entry::Occupied(entry) => entry,
    _ => panic!("expected occupied entry")
};

assert_eq!(entry.remove(), "value");
Examples
use ordered_multimap::ListOrderedMultimap;
use ordered_multimap::list_ordered_multimap::Entry;

let mut map = ListOrderedMultimap::new();
map.insert("key", "value1");

let mut entry = match map.entry("key") {
    Entry::Occupied(entry) => entry,
    _ => panic!("expected occupied entry")
};

entry.append("value2");

let mut iter = entry.remove_all();
assert_eq!(iter.next(), Some("value1"));
assert_eq!(iter.next(), Some("value2"));
assert_eq!(iter.next(), None);
source

pub fn remove_entry(self) -> (Key, Value)

Examples
use ordered_multimap::ListOrderedMultimap;
use ordered_multimap::list_ordered_multimap::Entry;

let mut map = ListOrderedMultimap::new();
map.insert("key", "value");

let mut entry = match map.entry("key") {
    Entry::Occupied(entry) => entry,
    _ => panic!("expected occupied entry")
};

assert_eq!(entry.remove_entry(), ("key", "value"));
source

pub fn remove_entry_all(self) -> (Key, EntryValuesDrain<'map, Key, Value>)

Examples
use ordered_multimap::ListOrderedMultimap;
use ordered_multimap::list_ordered_multimap::Entry;

let mut map = ListOrderedMultimap::new();
map.insert("key", "value1");

let mut entry = match map.entry("key") {
    Entry::Occupied(entry) => entry,
    _ => panic!("expected occupied entry")
};

entry.append("value2");

let (key, mut iter) = entry.remove_entry_all();
assert_eq!(key, "key");
assert_eq!(iter.next(), Some("value1"));
assert_eq!(iter.next(), Some("value2"));
assert_eq!(iter.next(), None);

Trait Implementations

Formats the value using the given formatter. 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 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.