11 releases
Uses old Rust 2015
0.3.2 | Oct 24, 2017 |
---|---|
0.3.1 | Oct 24, 2017 |
0.2.1 | Jun 27, 2016 |
0.1.3 | Jan 22, 2015 |
0.0.2 | Dec 7, 2014 |
#446 in Debugging
29 downloads per month
Used in 3 crates
(2 directly)
11KB
116 lines
TypeDef
Identify or compare types, get or print type names.
Since Rust 1.0, this library can only display type names on nightly Rust. On stable rust, it falls back to gobbledygook (type identifier) instead of a nice name.
To activate the nice names instead of gobbledygook, configure this library with
features = ["nightly"]
configuration parameter.
Quick example
use typedef::{ TypeDef };
// type name querying:
assert!(TypeDef::name_of::<i64>() == "i64");
// and also type value:
let typedef = TypeDef::of::<i64>();
assert!(typedef.is::<i64>());
assert!(typedef.get_str() == "i64");
assert!(typedef == TypeDef::of::<i64>());
println!("type is {:?}", typedef);
Usage
Put this in your Cargo.toml
:
[dependencies]
typedef = "0.3"
Configure nightly feature on you crate so that cargo argument --features="nightly"
would enable
nightly
feature on the typedef crate:
[features]
nightly = ["typedef/nightly"]
And this in your crate root:
extern crate typedef;
Resources
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.