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

#539 in Debugging

Download history 5/week @ 2024-08-26 5/week @ 2024-09-02 6/week @ 2024-09-09 9/week @ 2024-09-16 28/week @ 2024-09-23 18/week @ 2024-09-30 8/week @ 2024-10-21 5/week @ 2024-10-28 10/week @ 2024-11-04 8/week @ 2024-11-18 13/week @ 2024-11-25 19/week @ 2024-12-02 64/week @ 2024-12-09

104 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