Skip to content

Latest commit

 

History

History
 
 

inspect_type

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Module :: inspect_type

experimental rust-status docs.rs Open in Gitpod discord

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

Sample

#![ 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 implements

Try out from the repository

git clone https://github.com/Wandalen/wTools
cd wTools
cd sample/rust/inspect_type_trivial
cargo run