TypedContainer

Trait TypedContainer 

Source
pub trait TypedContainer {
    // Required method
    fn type_id(&self) -> TypeId;

    // Provided method
    fn holds<T>(&self) -> bool
       where T: 'static { ... }
}
Expand description

A trait for types that can hold values of different types.

Required Methods§

Source

fn type_id(&self) -> TypeId

Returns the std::any::TypeId of the contained value.

Provided Methods§

Source

fn holds<T>(&self) -> bool
where T: 'static,

Returns true excactly if the type of the contained vlaue is T.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§