| Crates.io | gettype |
| lib.rs | gettype |
| version | 1.0.0 |
| created_at | 2025-04-02 10:13:38.39188+00 |
| updated_at | 2025-04-02 10:13:38.39188+00 |
| description | A simple function to get the type of a value at runtime. |
| homepage | |
| repository | https://gitlab.com/celestifyx/gettype.git |
| max_upload_size | |
| id | 1616316 |
| size | 2,463 |
gettype is a simple Rust crate that provides a function to retrieve the type of a variable as a string, useful for debugging and logging.
To use this crate, add it as a dependency in your Cargo.toml:
[dependencies]
gettype = "1.0.0"
use gettype::get_type;
fn main() -> () {
let integer = 42;
let floating = 3.14;
let text = "Hello, Rust!";
println!("Type of integer: {}", get_type(&integer));
println!("Type of floating: {}", get_type(&floating));
println!("Type of text: {}", get_type(&text));
}
Type of integer: i32
Type of floating: f64
Type of text: &str