rust/library/core/src/slice
Ian Jackson 274e2993cb Stablize slice::strip_prefix and strip_suffix, with SlicePattern
We hope later to extend `core::str::Pattern` to slices too, perhaps as
part of stabilising that.  We want to minimise the amount of type
inference breakage when we do that, so we don't want to stabilise
strip_prefix and strip_suffix taking a simple `&[T]`.

@KodrAus suggested the approach of introducing a new perma-unstable
trait, which reduces this future inference break risk.

I found it necessary to make two impls of this trait, as the unsize
coercion don't apply when hunting for trait implementations.

Since SlicePattern's only method returns a reference, and the whole
trait is just a wrapper for slices, I made the trait type be the
non-reference type [T] or [T;N] rather than the reference.  Otherwise
the trait would have a lifetime parameter.

I marked both the no-op conversion functions `#[inline]`.  I'm not
sure if that is necessary but it seemed at the very least harmless.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2020-12-27 00:50:46 +00:00
..
iter Rename Iterator::get_unchecked 2020-09-25 19:52:01 +01:00
ascii.rs Move ascii to new module 2020-09-14 09:35:54 +00:00
cmp.rs Remove pointer comparison from slice equality 2020-12-26 06:43:51 +00:00
index.rs Check for exhaustion in SliceIndex for RangeInclusive 2020-10-20 17:18:08 -07:00
iter.rs Rollup merge of #76635 - scottmcm:slice-as-chunks, r=LukasKalbertodt 2020-10-27 08:44:41 +09:00
memchr.rs Document unsafety in core::slice::memchr 2020-10-05 11:34:03 +02:00
mod.rs Stablize slice::strip_prefix and strip_suffix, with SlicePattern 2020-12-27 00:50:46 +00:00
raw.rs use array::from_ref for slices 2020-09-23 21:56:23 +02:00
rotate.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
sort.rs Fix automatic_links warnings 2020-11-05 10:22:08 +01:00