Crates.io | t_bang |
lib.rs | t_bang |
version | 0.1.4 |
source | src |
created_at | 2015-10-16 07:10:29.65433 |
updated_at | 2015-12-11 23:56:40.231265 |
description | Provides macros for getting the type of a resource, `t!(variable)` will return the type as &str |
homepage | https://github.com/mfpiccolo/t_bang |
repository | https://github.com/mfpiccolo/t_bang |
max_upload_size | |
id | 3237 |
size | 1,395 |
This crate gives you some handy macros to return or print out the type of a variable, parameter or literal.
Declare the dependency for cargo
[dependencies]
t_bang = "0.1.2"
Then you can import and use the macros
#[macro_use] extern crate t_bang;
use t_bang::*;
fn main() {
let x = 5;
let x_type = t!(x);
println!("{:?}", x_type); // prints out: "i32"
pt!(x); // prints out: "i32"
pt!(5); // prints out: "i32"
}
t! will return the type of the resource as &str pt! will prints out the type of the resource