Struct typemap::TypeMap [] [src]

pub struct TypeMap {
    // some fields omitted
}

A map keyed by types.

Can contain one value of any type for each key type, as defined by the Assoc trait.

Methods

impl TypeMap
[src]

fn new() -> TypeMap

Create a new, empty TypeMap.

fn insert<K: Key>(&mut self, val: K::Value) -> Option<K::Value> where K::Value: Any

Insert a value into the map with a specified key type.

fn find<K: Key>(&self) -> Option<&K::Value> where K::Value: Any

Deprecated

Find a value in the map and get a reference to it.

fn find_mut<K: Key>(&mut self) -> Option<&mut K::Value> where K::Value: Any

Deprecated

Find a value in the map and get a mutable reference to it.

fn get<K: Key>(&self) -> Option<&K::Value> where K::Value: Any

Find a value in the map and get a reference to it.

fn get_mut<K: Key>(&mut self) -> Option<&mut K::Value> where K::Value: Any

Find a value in the map and get a mutable reference to it.

fn contains<K: Key>(&self) -> bool

Check if a key has an associated value stored in the map.

fn remove<K: Key>(&mut self) -> Option<K::Value> where K::Value: Any

Remove a value from the map.

Returns true if a value was removed.

fn entry<'a, K: Key>(&'a mut self) -> Entry<'a, K> where K::Value: Any

Get the given key's corresponding entry in the map for in-place manipulation.

unsafe fn data(&self) -> &HashMap<TypeIdBox<UnsafeAny>>

Read the underlying HashMap

unsafe fn data_mut(&mut self) -> &mut HashMap<TypeIdBox<UnsafeAny>>

Get a mutable reference to the underlying HashMap

fn len(&self) -> usize

Get the number of values stored in the map.

fn is_empty(&self) -> bool

Return true if the map contains no values.

fn clear(&mut self)

Remove all entries from the map.

Trait Implementations

impl Default for TypeMap
[src]

fn default() -> TypeMap

Returns the "default value" for a type. Read more