gettype

Crates.iogettype
lib.rsgettype
version1.0.0
created_at2025-04-02 10:13:38.39188+00
updated_at2025-04-02 10:13:38.39188+00
descriptionA simple function to get the type of a value at runtime.
homepage
repositoryhttps://gitlab.com/celestifyx/gettype.git
max_upload_size
id1616316
size2,463
old (CelestifyX)

documentation

README

gettype

Overview

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.

How to use

To use this crate, add it as a dependency in your Cargo.toml:

[dependencies]
gettype = "1.0.0"

Example code:

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));
}

Output:

Type of integer: i32
Type of floating: f64
Type of text: &str
Commit count: 0

cargo fmt