soa_rs/
as_soa_ref.rs

1use crate::Soars;
2
3/// Similar to [`AsRef`], but for [`Soars::Ref`].
4///
5/// This is primarily used to provide convenient implementations of standard
6/// traits for [`Slice`].
7///
8/// [`Slice`]: crate::Slice
9pub trait AsSoaRef {
10    /// The type to get a reference of.
11    ///
12    /// When using the [`Soars`] derive macro, this is the type that was derived
13    /// from and which is the generic parameter of [`Slice`] and [`Soa`].
14    ///
15    /// [`Slice`]: crate::Slice
16    /// [`Soa`]: crate::Soa
17    type Item: Soars;
18
19    /// Converts this type to an SoA reference of the associated type.
20    fn as_soa_ref(&self) -> <Self::Item as Soars>::Ref<'_>;
21}