pub trait SlicePattern {
    type Item;

    // Required method
    fn as_slice(&self) -> &[Self::Item];
}
🔬This is a nightly-only experimental API. (slice_pattern)
Available on non-crate feature miri-test-libstd only.
Expand description

Patterns in slices - currently, only used by strip_prefix and strip_suffix. At a future point, we hope to generalise core::str::Pattern (which at the time of writing is limited to str) to slices, and then this trait will be replaced or abolished.

Required Associated Types§

source

type Item

🔬This is a nightly-only experimental API. (slice_pattern)

The element type of the slice being matched on.

Required Methods§

source

fn as_slice(&self) -> &[Self::Item]

🔬This is a nightly-only experimental API. (slice_pattern)

Currently, the consumers of SlicePattern need a slice.

Implementors§

1.51.0 · source§

impl<T> SlicePattern for [T]

§

type Item = T

1.51.0 · source§

impl<T, const N: usize> SlicePattern for [T; N]

§

type Item = T