#fundamental #general-purpose #diagnostic-purpose

no-std dev inspect_type

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

13 releases (breaking)

0.9.0 Mar 16, 2024
0.7.0 Mar 16, 2024
0.5.0 Oct 28, 2023
0.1.2 May 25, 2022
0.0.8 Nov 30, 2021

#2333 in Development tools

Download history 135/week @ 2023-12-22 14/week @ 2023-12-29 107/week @ 2024-01-05 205/week @ 2024-01-12 77/week @ 2024-01-19 67/week @ 2024-01-26 53/week @ 2024-02-02 119/week @ 2024-02-09 178/week @ 2024-02-16 139/week @ 2024-02-23 316/week @ 2024-03-01 196/week @ 2024-03-08 622/week @ 2024-03-15 220/week @ 2024-03-22 254/week @ 2024-03-29 124/week @ 2024-04-05

1,231 downloads per month
Used in 81 crates (via typing_tools)

MIT license

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