#slice #general-purpose #fundamental #macro #questions

no-std dev is_slice

Macro to answer the question: is it a slice?

13 releases (breaking)

new 0.9.0 May 11, 2024
0.8.0 Mar 16, 2024
0.7.0 Mar 16, 2024
0.4.0 Oct 28, 2023
0.0.1 Nov 29, 2021

#2358 in Development tools

Download history 58/week @ 2024-01-22 48/week @ 2024-01-29 91/week @ 2024-02-05 156/week @ 2024-02-12 78/week @ 2024-02-19 321/week @ 2024-02-26 236/week @ 2024-03-04 575/week @ 2024-03-11 238/week @ 2024-03-18 213/week @ 2024-03-25 271/week @ 2024-04-01 127/week @ 2024-04-08 157/week @ 2024-04-15 153/week @ 2024-04-22 152/week @ 2024-04-29 232/week @ 2024-05-06

727 downloads per month
Used in 82 crates (via typing_tools)

MIT license

10KB
75 lines

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

No runtime deps