#general-purpose #diagnostic-purpose

dev inspect_type

Diagnostic-purpose tools to inspect type of a variable and its size

16 breaking releases

0.16.0 Jun 21, 2025
0.14.0 Apr 13, 2025
0.12.0 Oct 30, 2024
0.10.0 May 11, 2024
0.0.8 Nov 30, 2021

#480 in Development tools

Download history 164/week @ 2025-10-04 196/week @ 2025-10-11 384/week @ 2025-10-18 292/week @ 2025-10-25 292/week @ 2025-11-01 279/week @ 2025-11-08 321/week @ 2025-11-15 268/week @ 2025-11-22 335/week @ 2025-11-29 269/week @ 2025-12-06 227/week @ 2025-12-13 318/week @ 2025-12-20 230/week @ 2025-12-27 355/week @ 2026-01-03 84/week @ 2026-01-10 362/week @ 2026-01-17

1,078 downloads per month
Used in 69 crates (3 directly)

MIT license

9KB
71 lines

Module :: inspect_type

experimental rust-status docs.rs Open in Gitpod discord

Diagnostic-purpose tools to inspect type of a variable and its size.

Basic use-case

// #![ cfg_attr( feature = "nightly", feature( type_name_of_val ) ) ]
pub use inspect_type::*;

#[ cfg( feature = "nightly" ) ]
{
  inspect_type_of!( &[ 1, 2, 3 ][ .. ] );
  // < sizeof( &[1, 2, 3][..] : &[i32] ) = 16
  inspect_type_of!( &[ 1, 2, 3 ] );
  // < sizeof( &[1, 2, 3] : &[i32; 3] ) = 8
}

To add to your project

cargo add inspect_type

Try out from the repository

git clone https://github.com/Wandalen/wTools
cd wTools
cargo run --example inspect_type_trivial

No runtime deps

~9KB