Crate is_slice

source ·
Expand description

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

§Module :: is_slice

experimental rust-status docs.rs Open in Gitpod discord

Macro to answer the question: is it a slice?

§Basic use-case

use is_slice::*;

dbg!( is_slice!( Box::new( true ) ) );
// < is_slice!(Box :: new(true)) = false
dbg!( is_slice!( &[ 1, 2, 3 ] ) );
// < is_slice!(& [1, 2, 3]) = false
dbg!( is_slice!( &[ 1, 2, 3 ][ .. ] ) );
// < is_slice!(& [1, 2, 3] [..]) = true

§To add to your project

cargo add is_slice

§Try out from the repository

git clone https://github.com/Wandalen/wTools
cd wTools
cd examples/is_slice_trivial
cargo run

Modules§

  • Exposed namespace of the module.
  • Orphan namespace of the module.
  • Prelude to use essentials: use my_module::prelude::*.
  • Protected namespace of the module.

Macros§

  • Macro to answer the question: is it a slice?