#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

#2125 in Development tools

Download history 67/week @ 2024-01-25 28/week @ 2024-02-01 109/week @ 2024-02-08 176/week @ 2024-02-15 157/week @ 2024-02-22 305/week @ 2024-02-29 215/week @ 2024-03-07 599/week @ 2024-03-14 213/week @ 2024-03-21 257/week @ 2024-03-28 155/week @ 2024-04-04 161/week @ 2024-04-11 179/week @ 2024-04-18 167/week @ 2024-04-25 162/week @ 2024-05-02 371/week @ 2024-05-09

893 downloads per month
Used in 82 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