Function orx_pinned_vec::utils::slice::contains_reference
source · pub fn contains_reference<T>(slice: &[T], element: &T) -> bool
Expand description
Returns whether or not element
with the given reference belongs to the given slice
.
This method has O(1) time complexity.
§Safety
The underlying memory of the slice &[T]
stays pinned as long as
the reference is in scope; i.e., is not carried to different memory locations.
Therefore, it is possible and safe to compare an element’s reference to find its position in the vector.
Out of bounds checks are in place.