Trait deferred_reference::SlicePointerIndex [−][src]
A helper trait used for indexing operations, which is modeled after the SliceIndex trait from the Rust core library, but which promises not to take a reference to the underlying slice.
Safety
Implementations of this trait have to promise that:
- If the argument to get_(mut_)unchecked is a safe pointer, then so is the result.
- The pointers may not be dereferenced (both pointers given as arguments as well as the returned pointers).
Associated Types
Loading content...Required methods
fn get(self, slice: *const T) -> Option<*const Self::Output>
[src]
Returns a shared pointer to the output at this location, if in bounds.
fn get_mut(self, slice: *mut T) -> Option<*mut Self::Output>
[src]
Returns a mutable poiner to the output at this location, if in bounds.
unsafe fn get_unchecked(self, slice: *const T) -> *const Self::Output
[src]
Returns a shared pointer to the output at this location, without
performing any bounds checking.
Calling this method with an out-of-bounds index or a dangling slice
pointer
is undefined behavior even if the resulting reference is not used.
unsafe fn get_unchecked_mut(self, slice: *mut T) -> *mut Self::Output
[src]
Returns a mutable pointer to the output at this location, without
performing any bounds checking.
Calling this method with an out-of-bounds index or a dangling slice
pointer
is undefined behavior even if the resulting reference is not used.
fn index(self, slice: *const T) -> *const Self::Output
[src]
Returns a shared pointer to the output at this location, panicking if out of bounds.
fn index_mut(self, slice: *mut T) -> *mut Self::Output
[src]
Returns a mutable pointer to the output at this location, panicking if out of bounds.
Implementations on Foreign Types
impl<T: ?Sized> SlicePointerIndex<T> for Range<usize> where
T: SliceLike,
[src]
T: SliceLike,
type Output = [T::Element]
fn get(self, slice: *const T) -> Option<*const Self::Output>
[src]
fn get_mut(self, slice: *mut T) -> Option<*mut Self::Output>
[src]
unsafe fn get_unchecked(self, slice: *const T) -> *const Self::Output
[src]
unsafe fn get_unchecked_mut(self, slice: *mut T) -> *mut Self::Output
[src]
fn index(self, slice: *const T) -> *const Self::Output
[src]
fn index_mut(self, slice: *mut T) -> *mut Self::Output
[src]
impl<T: ?Sized> SlicePointerIndex<T> for RangeTo<usize> where
T: SliceLike,
[src]
T: SliceLike,
type Output = [T::Element]
fn get(self, slice: *const T) -> Option<*const Self::Output>
[src]
fn get_mut(self, slice: *mut T) -> Option<*mut Self::Output>
[src]
unsafe fn get_unchecked(self, slice: *const T) -> *const Self::Output
[src]
unsafe fn get_unchecked_mut(self, slice: *mut T) -> *mut Self::Output
[src]
fn index(self, slice: *const T) -> *const Self::Output
[src]
fn index_mut(self, slice: *mut T) -> *mut Self::Output
[src]
impl<T: ?Sized> SlicePointerIndex<T> for RangeFrom<usize> where
T: SliceLike,
[src]
T: SliceLike,
type Output = [T::Element]
fn get(self, slice: *const T) -> Option<*const Self::Output>
[src]
fn get_mut(self, slice: *mut T) -> Option<*mut Self::Output>
[src]
unsafe fn get_unchecked(self, slice: *const T) -> *const Self::Output
[src]
unsafe fn get_unchecked_mut(self, slice: *mut T) -> *mut Self::Output
[src]
fn index(self, slice: *const T) -> *const Self::Output
[src]
fn index_mut(self, slice: *mut T) -> *mut Self::Output
[src]
impl<T> SlicePointerIndex<[T]> for RangeFull
[src]
type Output = [T]
fn get(self, slice: *const [T]) -> Option<*const [T]>
[src]
fn get_mut(self, slice: *mut [T]) -> Option<*mut [T]>
[src]
unsafe fn get_unchecked(self, slice: *const [T]) -> *const [T]
[src]
unsafe fn get_unchecked_mut(self, slice: *mut [T]) -> *mut [T]
[src]
fn index(self, slice: *const [T]) -> *const [T]
[src]
fn index_mut(self, slice: *mut [T]) -> *mut [T]
[src]
impl<T, const N: usize> SlicePointerIndex<[T; N]> for RangeFull
[src]
type Output = [T]
fn get(self, slice: *const [T; N]) -> Option<*const [T]>
[src]
fn get_mut(self, slice: *mut [T; N]) -> Option<*mut [T]>
[src]
unsafe fn get_unchecked(self, slice: *const [T; N]) -> *const [T]
[src]
unsafe fn get_unchecked_mut(self, slice: *mut [T; N]) -> *mut [T]
[src]
fn index(self, slice: *const [T; N]) -> *const [T]
[src]
fn index_mut(self, slice: *mut [T; N]) -> *mut [T]
[src]
impl<T: ?Sized> SlicePointerIndex<T> for RangeInclusive<usize> where
T: SliceLike,
[src]
T: SliceLike,
type Output = [T::Element]
fn get(self, slice: *const T) -> Option<*const Self::Output>
[src]
fn get_mut(self, slice: *mut T) -> Option<*mut Self::Output>
[src]
unsafe fn get_unchecked(self, slice: *const T) -> *const Self::Output
[src]
unsafe fn get_unchecked_mut(self, slice: *mut T) -> *mut Self::Output
[src]
fn index(self, slice: *const T) -> *const Self::Output
[src]
fn index_mut(self, slice: *mut T) -> *mut Self::Output
[src]
impl<T: ?Sized> SlicePointerIndex<T> for RangeToInclusive<usize> where
T: SliceLike,
[src]
T: SliceLike,
type Output = [T::Element]
fn get(self, slice: *const T) -> Option<*const Self::Output>
[src]
fn get_mut(self, slice: *mut T) -> Option<*mut Self::Output>
[src]
unsafe fn get_unchecked(self, slice: *const T) -> *const Self::Output
[src]
unsafe fn get_unchecked_mut(self, slice: *mut T) -> *mut Self::Output
[src]
fn index(self, slice: *const T) -> *const Self::Output
[src]
fn index_mut(self, slice: *mut T) -> *mut Self::Output
[src]
Implementors
impl<T: ?Sized> SlicePointerIndex<T> for usize where
T: SliceLike,
[src]
T: SliceLike,