pub trait TiSliceIndex<K, V>: Sealed<K> {
type Output: ?Sized;
// Required methods
fn get(self, slice: &TiSlice<K, V>) -> Option<&Self::Output>;
fn get_mut(self, slice: &mut TiSlice<K, V>) -> Option<&mut Self::Output>;
unsafe fn get_unchecked(self, slice: &TiSlice<K, V>) -> &Self::Output;
unsafe fn get_unchecked_mut(
self,
slice: &mut TiSlice<K, V>,
) -> &mut Self::Output;
fn index(self, slice: &TiSlice<K, V>) -> &Self::Output;
fn index_mut(self, slice: &mut TiSlice<K, V>) -> &mut Self::Output;
}Expand description
A helper trait used for indexing operations.
This trait is implemented for K, Range<K>, RangeTo<K>,
RangeFrom<K>, RangeInclusive<K> and RangeToInclusive<K>.
The RangeFull<K> trait is not currently supported.
Trait implementations are only forwards to standard Rust slice
operations.
Required Associated Types§
Required Methods§
Sourcefn get(self, slice: &TiSlice<K, V>) -> Option<&Self::Output>
fn get(self, slice: &TiSlice<K, V>) -> Option<&Self::Output>
Returns a shared reference to the output at this location, if in bounds.
Sourcefn get_mut(self, slice: &mut TiSlice<K, V>) -> Option<&mut Self::Output>
fn get_mut(self, slice: &mut TiSlice<K, V>) -> Option<&mut Self::Output>
Returns a mutable reference to the output at this location, if in bounds.
Sourceunsafe fn get_unchecked(self, slice: &TiSlice<K, V>) -> &Self::Output
unsafe fn get_unchecked(self, slice: &TiSlice<K, V>) -> &Self::Output
Returns a shared reference to the output at this location, without performing any bounds checking.
§Safety
Calling this method with an out-of-bounds index is undefined behavior even if the resulting reference is not used.
Sourceunsafe fn get_unchecked_mut(
self,
slice: &mut TiSlice<K, V>,
) -> &mut Self::Output
unsafe fn get_unchecked_mut( self, slice: &mut TiSlice<K, V>, ) -> &mut Self::Output
Returns a mutable reference to the output at this location, without performing any bounds checking.
§Safety
Calling this method with an out-of-bounds index is undefined behavior even if the resulting reference is not used.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".