pub trait UnsafeIndex<Idx> {
type Output;
// Required methods
unsafe fn unsafe_index(&self, index: Idx) -> &Self::Output;
unsafe fn unsafe_index_mut(&self, index: Idx) -> &mut Self::Output;
}Expand description
Unsafe Index trait.
Like Index, performs checked indexing, but the caller must ensure that there is no aliasing of a mutable reference.
Required Associated Types§
Required Methods§
Sourceunsafe fn unsafe_index(&self, index: Idx) -> &Self::Output
unsafe fn unsafe_index(&self, index: Idx) -> &Self::Output
Immutably indexes with index.
§Safety
The caller must ensure that the returned reference is not aliased by a mutable borrow, ie by a call to .unsafe_index_mut() with the same index.
Sourceunsafe fn unsafe_index_mut(&self, index: Idx) -> &mut Self::Output
unsafe fn unsafe_index_mut(&self, index: Idx) -> &mut Self::Output
Mutably indexes with index.
§Safety
The caller must ensure that the returned reference is not aliased by another borrow, ie by a call to .unsafe_index() or .unsafe_index_mut() with the same index.