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

no-std dev is_slice

Macro to answer the question: is it a slice?

12 releases (breaking)

0.8.0 Mar 16, 2024
0.6.0 Mar 16, 2024
0.4.0 Oct 28, 2023
0.1.1 May 25, 2022
0.0.1 Nov 29, 2021

#1761 in Development tools

Download history 135/week @ 2023-12-22 12/week @ 2023-12-29 107/week @ 2024-01-05 207/week @ 2024-01-12 76/week @ 2024-01-19 67/week @ 2024-01-26 51/week @ 2024-02-02 119/week @ 2024-02-09 146/week @ 2024-02-16 132/week @ 2024-02-23 299/week @ 2024-03-01 241/week @ 2024-03-08 620/week @ 2024-03-15 220/week @ 2024-03-22 252/week @ 2024-03-29 126/week @ 2024-04-05

1,229 downloads per month
Used in 81 crates (via typing_tools)

MIT license

9KB
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