trait TrySlice<T> {
// Required methods
fn try_mut<I>(&mut self, index: I) -> Result<&mut [T], Error>
where I: SliceIndex<[T], Output = [T]>;
fn try_ref<I>(&self, index: I) -> Result<&[T], Error>
where I: SliceIndex<[T], Output = [T]>;
}Expand description
Slicing that reports a caller buffer sized too small, rather than panicking or silently truncating.
Required Methods§
fn try_mut<I>(&mut self, index: I) -> Result<&mut [T], Error>
fn try_ref<I>(&self, index: I) -> Result<&[T], Error>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".