type_map

Struct TypeMap

Source
pub struct TypeMap { /* private fields */ }
Expand description

The typemap container

Implementations§

Source§

impl TypeMap

Source

pub fn new() -> Self

Create an empty TypeMap.

Source

pub fn insert_kv_pair(&mut self, KvPair: KvPair) -> Option<KvPair>

Insert a prepared KvPair into this TypeMap.

If a value of this type already exists, it will be returned.

Source

pub fn insert<T: 'static>(&mut self, val: T) -> Option<T>

Insert a value into this TypeMap.

If a value of this type already exists, it will be returned.

Source

pub fn contains<T: 'static>(&self) -> bool

Check if container contains value for type

Source

pub fn get<T: 'static>(&self) -> Option<&T>

Get a reference to a value previously inserted on this TypeMap.

Source

pub fn get_mut<T: 'static>(&mut self) -> Option<&mut T>

Get a mutable reference to a value previously inserted on this TypeMap.

Source

pub fn remove<T: 'static>(&mut self) -> Option<T>

Remove a value from this TypeMap.

If a value of this type exists, it will be returned.

Source

pub fn clear(&mut self)

Clear the TypeMap of all inserted values.

Source

pub fn entry<T: 'static>(&mut self) -> Entry<'_, T>

Get an entry in the TypeMap for in-place manipulation.

Trait Implementations§

Source§

impl Debug for TypeMap

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TypeMap

Source§

fn default() -> TypeMap

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for TypeMap

§

impl !RefUnwindSafe for TypeMap

§

impl !Send for TypeMap

§

impl !Sync for TypeMap

§

impl Unpin for TypeMap

§

impl !UnwindSafe for TypeMap

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.