Trait soa_derive::SoAIndex

source ·
pub trait SoAIndex<T>: Sealed {
    type RefOutput;

    // Required methods
    fn get(self, soa: T) -> Option<Self::RefOutput>;
    unsafe fn get_unchecked(self, soa: T) -> Self::RefOutput;
    fn index(self, soa: T) -> Self::RefOutput;
}
Expand description

Helper trait used for indexing operations. Inspired by std::slice::SliceIndex.

Required Associated Types§

source

type RefOutput

The output for the non-mutable functions

Required Methods§

source

fn get(self, soa: T) -> Option<Self::RefOutput>

Returns the reference output in this location if in bounds, None otherwise.

source

unsafe fn get_unchecked(self, soa: T) -> Self::RefOutput

Returns the reference output in this location without performing any bounds check.

Safety

The index must be in bounds.

source

fn index(self, soa: T) -> Self::RefOutput

Returns the reference output in this location. Panics if it is not in bounds.

Implementors§