#general-purpose #fundamental #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

#2901 in Algorithms

Download history 153/week @ 2024-11-29 277/week @ 2024-12-06 96/week @ 2024-12-13 55/week @ 2024-12-20 24/week @ 2024-12-27 55/week @ 2025-01-03 60/week @ 2025-01-10 63/week @ 2025-01-17 53/week @ 2025-01-24 64/week @ 2025-01-31 65/week @ 2025-02-07 239/week @ 2025-02-14 238/week @ 2025-02-21 127/week @ 2025-02-28 59/week @ 2025-03-07 190/week @ 2025-03-14

630 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