#fundamental #general-purpose #diagnostic-purpose

no-std dev inspect_type

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

14 releases (breaking)

new 0.10.0 May 11, 2024
0.9.0 Mar 16, 2024
0.8.0 Mar 16, 2024
0.5.0 Oct 28, 2023
0.0.8 Nov 30, 2021

#2216 in Development tools

Download history 72/week @ 2024-01-20 48/week @ 2024-01-27 64/week @ 2024-02-03 130/week @ 2024-02-10 163/week @ 2024-02-17 264/week @ 2024-02-24 197/week @ 2024-03-02 192/week @ 2024-03-09 634/week @ 2024-03-16 218/week @ 2024-03-23 251/week @ 2024-03-30 137/week @ 2024-04-06 193/week @ 2024-04-13 155/week @ 2024-04-20 156/week @ 2024-04-27 156/week @ 2024-05-04

662 downloads per month
Used in 81 crates (via typing_tools)

MIT license

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