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

#404 in Debugging

Download history 44/week @ 2023-10-28 27/week @ 2023-11-04 22/week @ 2023-11-11 24/week @ 2023-11-18 59/week @ 2023-11-25 25/week @ 2023-12-02 20/week @ 2023-12-09 37/week @ 2023-12-16 42/week @ 2023-12-23 22/week @ 2023-12-30 21/week @ 2024-01-06 20/week @ 2024-01-13 28/week @ 2024-01-20 33/week @ 2024-01-27 16/week @ 2024-02-03 56/week @ 2024-02-10

137 downloads per month
Used in 3 crates (2 directly)

MIT/Apache

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.

Build Status

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

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.

No runtime deps

Features