pub unsafe trait TrustedContainer {
type Item: ?Sized + TrustedItem<Self>;
type Slice: ?Sized;
// Required methods
fn unit_len(&self) -> usize;
unsafe fn get_unchecked(&self, i: usize) -> &Self::Item;
unsafe fn slice_unchecked(&self, r: Range<usize>) -> &Self::Slice;
}
Expand description
Types that can back a trusted container: it can have indices and ranges that are trusted to be in bounds.
It must have a continuously addressable range.
Required Associated Types§
Required Methods§
unsafe fn get_unchecked(&self, i: usize) -> &Self::Item
unsafe fn slice_unchecked(&self, r: Range<usize>) -> &Self::Slice
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl TrustedContainer for str
impl TrustedContainer for str
Source§impl TrustedContainer for String
Available on crate feature std
only.
impl TrustedContainer for String
Available on crate feature
std
only.Source§impl<T> TrustedContainer for [T]
impl<T> TrustedContainer for [T]
Source§impl<T> TrustedContainer for Vec<T>
Available on crate feature std
only.
impl<T> TrustedContainer for Vec<T>
Available on crate feature
std
only.Source§impl<T: TrustedContainer + ?Sized> TrustedContainer for &T
impl<T: TrustedContainer + ?Sized> TrustedContainer for &T
Source§impl<T: TrustedContainer + ?Sized> TrustedContainer for Box<T>
Available on crate feature std
only.
impl<T: TrustedContainer + ?Sized> TrustedContainer for Box<T>
Available on crate feature
std
only.