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

#185 in Debugging

Download history 36/week @ 2022-06-08 14/week @ 2022-06-15 34/week @ 2022-06-22 38/week @ 2022-06-29 37/week @ 2022-07-06 19/week @ 2022-07-13 34/week @ 2022-07-20 22/week @ 2022-07-27 16/week @ 2022-08-03 25/week @ 2022-08-10 11/week @ 2022-08-17 23/week @ 2022-08-24 13/week @ 2022-08-31 36/week @ 2022-09-07 13/week @ 2022-09-14 14/week @ 2022-09-21

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

MIT/Apache

10KB
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

  • nightly