typeable/
lib.rs

1#![deny(missing_docs)]
2#![deny(warnings)]
3
4//! Exposes `Typeable`, which exposes the `get_type` method, which gives
5//! the `TypeId` of any 'static type.
6
7use std::any::{Any, TypeId};
8
9/// Universal mixin trait for adding a `get_type` method.
10///
11pub trait Typeable: Any {
12    /// Get the `TypeId` of this object.
13    #[inline(always)]
14    fn get_type(&self) -> TypeId { TypeId::of::<Self>() }
15}
16
17impl<T: Any> Typeable for T {}
18