pub trait ArrayAccessor: Array {
type Item: Send + Sync;
// Required methods
fn value(&self, index: usize) -> Self::Item;
unsafe fn value_unchecked(&self, index: usize) -> Self::Item;
}
Expand description
A generic trait for accessing the values of an Array
§Validity
An ArrayAccessor
must always return a well-defined value for an index that is
within the bounds 0..Array::len
, including for null indexes where Array::is_null
is true.
The value at null indexes is unspecified, and implementations must not rely on a specific
value such as Default::default
being returned, however, it must not be undefined
Required Associated Types§
Required Methods§
Sourceunsafe fn value_unchecked(&self, index: usize) -> Self::Item
unsafe fn value_unchecked(&self, index: usize) -> Self::Item
Returns the element at index i
§Safety
Caller is responsible for ensuring that the index is within the bounds of the array