#extension #slice #split #predicate #found #matched #start

slice-ext

Useful extensions to slices and iterable types

5 releases

0.1.4 May 27, 2020
0.1.3 May 25, 2020
0.1.2 Mar 26, 2019
0.1.1 Mar 25, 2019
0.1.0 Mar 25, 2019

#2790 in Rust patterns


Used in 4 crates (via dsf-core)

MIT license

9KB
166 lines

slice-ext

Slice extensions for rust, this is intended to be extended as more useful primitives are identified.

Status

GitHub tag Build Status Crates.io Docs.rs

Work in progress, would be good to genericise over AsRef<T> instead of &'a [T], should work tho.

Features

  • split_before to split using a predicate while including the matched item at the start of each subslice if found
  • split_after to split using a predicate while including the matched item at the end of the subslice if found

No runtime deps