Struct typedef::TypeDef
[−]
[src]
pub struct TypeDef {
// some fields omitted
}Create a TypeDef structure to identify a type and to print its name.
use typedef::{ TypeDef }; let typedef = TypeDef::of::<i64>(); assert!(typedef.is::<i64>()); assert!(typedef.get_str() == "i64");
Methods
impl TypeDef[src]
fn of<T: Any>() -> TypeDef
Create a TypeDef structure from a type parameter.
use typedef::{ TypeDef }; let typedef = TypeDef::of::<i64>();
fn id_of<T: Any>() -> TypeId
Get TypeId for specified type directly.
use std::any::{ TypeId }; use typedef::{ TypeDef }; assert!(TypeDef::id_of::<i64>() == TypeId::of::<i64>());
fn name_of<T: Any>() -> &'static str
Get type name for specified type directly.
use typedef::{ TypeDef }; assert_eq!(TypeDef::name_of::<i64>(), "i64");
fn is<T: Any>(&self) -> bool
Check if typedef instance matches type.
use typedef::{ TypeDef }; let typedef = TypeDef::of::<i64>(); assert!(typedef.is::<i64>());
fn get_str(&self) -> &'static str
Get the static &str for typedef instance.
use typedef::{ TypeDef }; let typedef = TypeDef::of::<i64>(); assert!(typedef.get_str() == "i64");
Trait Implementations
impl PartialEq for TypeDef[src]
fn eq(&self, other: &TypeDef) -> bool
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &Rhs) -> bool1.0.0
This method tests for !=.
impl Display for TypeDef[src]
Derived Implementations
impl Copy for TypeDef[src]
impl Clone for TypeDef[src]
fn clone(&self) -> TypeDef
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0
Performs copy-assignment from source. Read more