inspect_type 0.17.0

Diagnostic-purpose tools to inspect type of a variable and its size.
Documentation
#![doc(html_logo_url = "https://raw.githubusercontent.com/Wandalen/wTools/master/asset/img/logo_v3_trans_square.png")]
#![doc(
  html_favicon_url = "https://raw.githubusercontent.com/Wandalen/wTools/alpha/asset/img/logo_v3_trans_square_icon_small_v2.ico"
)]
#![doc(html_root_url = "https://docs.rs/inspect_type/latest/inspect_type/")]
#![ cfg_attr( doc, doc = include_str!( concat!( env!( "CARGO_MANIFEST_DIR" ), "/", "readme.md" ) ) ) ]
#![ cfg_attr( not( doc ), doc = "Type inspection utilities" ) ]
/// Type inspection macros and utilities.
mod inspect
{
  /// Macro to inspect type of a variable and its size exporting it as a string.
  ///
  /// This macro intentionally takes a reference of the passed expression to inspect
  /// its type and size without moving it. When the expression is already a reference,
  /// this creates a reference-to-reference pattern, which is correct for this use case.
  #[ macro_export ]
  macro_rules! inspect_to_str_type_of
  {
    ( $src: expr ) =>
    {{
      #[ allow( clippy::size_of_ref ) ]
      {
        let value = $src;
        let mut result = String::new();
        let stringified = stringify!( $src );
        let size = &std::mem::size_of_val( &value ).to_string()[ .. ];
        let type_name = std::any::type_name_of_val( &value );
        result.push_str( &format!( "sizeof( {} : {} ) = {}", stringified, type_name, size )[ .. ] );
        result
      }
    }};
 }

  /// Macro to inspect type of a variable and its size printing into stdout and exporting it as a string.
  #[ macro_export ]
  macro_rules! inspect_type_of
  {
    ( $src: expr ) =>
    {{
      let result = $crate::inspect_to_str_type_of!( $src );
      println!( "{}", result );
      result
    }};
  }

  pub use inspect_to_str_type_of;
  pub use inspect_type_of;
}

#[ doc( inline ) ]
#[ allow( unused_imports ) ]
pub use own::*;

/// Own namespace of the module.
#[ allow( unused_imports ) ]
pub mod own
{
  use super::orphan;
  #[ doc( inline ) ]
  pub use orphan::*;
}

/// Orphan namespace of the module.
#[ allow( unused_imports ) ]
pub mod orphan
{
  use super::exposed;
  #[ doc( inline ) ]
  pub use exposed::*;
}

/// Exposed namespace of the module.
#[ allow( unused_imports ) ]
pub mod exposed
{
  use super::prelude;
  #[ doc( inline ) ]
  pub use prelude::*;
}

/// Prelude to use essentials: `use my_module::prelude::*`.
#[ allow( unused_imports ) ]
pub mod prelude
{
  #[ doc( inline ) ]
  pub use crate::inspect::*;
}