inspect_type

Crates.ioinspect_type
lib.rsinspect_type
version0.10.0
sourcesrc
created_at2021-11-30 06:29:07.025209
updated_at2024-05-11 22:36:15.26698
descriptionDiagnostic-purpose tools to inspect type of a variable and its size.
homepagehttps://github.com/Wandalen/wTools/tree/master/module/core/inspect_type
repositoryhttps://github.com/Wandalen/wTools/tree/master/module/core/inspect_type
max_upload_size
id489667
size32,365
Wandalen (Wandalen)

documentation

https://docs.rs/inspect_type

README

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
Commit count: 0

cargo fmt