Expand description
A trait for any slice, with item as an associated type.
This crate is a subset of the crate slice_ops
.
§Example
#![feature(const_trait_impl)]
use slice_trait::*;
const A: &[i32] = [1, 2, 3].as_slice();
const fn first<'a, S: ~const Slice + ?Sized>(slice: &'a S) -> Option<&'a S::Item>
where
S::Item: Copy,
{
slice.as_slice().first()
}
assert_eq!(first(A), Some(&1));
Traits§
- AsSlice
- A trait for obtaining a slice
[Self::Item]
- Boxed
Slice - A trait for a boxed slice
[Self::Elem]
- Into
Boxed Slice - A trait for obtaining a boxed slice
[Self::Elem]
- Slice
- A trait for a slice
[Self::Elem]
Trait Aliases§
- Boxed
Slice Prereq - Prerequesites for a boxed slice of
T
- Slice
Prereq - Prerequesites for a slice of
T