#fundamental #general-purpose #diagnostic-purpose

dev inspect_type

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

16 releases (breaking)

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

#2513 in Development tools

Download history 177/week @ 2024-07-22 450/week @ 2024-07-29 177/week @ 2024-08-05 212/week @ 2024-08-12 124/week @ 2024-08-19 219/week @ 2024-08-26 124/week @ 2024-09-02 353/week @ 2024-09-09 215/week @ 2024-09-16 296/week @ 2024-09-23 144/week @ 2024-09-30 69/week @ 2024-10-07 244/week @ 2024-10-14 192/week @ 2024-10-21 294/week @ 2024-10-28 181/week @ 2024-11-04

915 downloads per month
Used in 77 crates (via typing_tools)

MIT license

9KB
98 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

~10KB