Merge branch 'main' into specialize-exprs

This commit is contained in:
Agus Zubiaga 2024-11-23 01:48:51 -03:00
commit 2e96aca0fd
No known key found for this signature in database
797 changed files with 17394 additions and 12632 deletions

View file

@ -7,25 +7,6 @@ use core::{
use crate::soa_index::Index;
#[derive(PartialEq, Eq, PartialOrd, Ord)]
pub struct NonEmptySlice<T> {
inner: Slice<T>,
}
impl<T> fmt::Debug for NonEmptySlice<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.inner.fmt(f)
}
}
impl<T> Copy for NonEmptySlice<T> {}
impl<T> Clone for NonEmptySlice<T> {
fn clone(&self) -> Self {
*self
}
}
/// A slice into an array of values, based
/// on an offset into the array rather than a pointer.
///
@ -111,6 +92,13 @@ impl<T> Slice<T> {
}
}
pub fn at(&self, i: usize) -> Index<T> {
Index {
index: self.start + i as u32,
_marker: PhantomData,
}
}
pub const fn new(start: u32, length: u16) -> Self {
Self {
start,
@ -179,6 +167,25 @@ pub trait GetSlice<T> {
fn get_slice(&self, slice: Slice<T>) -> &[T];
}
#[derive(PartialEq, Eq, PartialOrd, Ord)]
pub struct NonEmptySlice<T> {
inner: Slice<T>,
}
impl<T> fmt::Debug for NonEmptySlice<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.inner.fmt(f)
}
}
impl<T> Copy for NonEmptySlice<T> {}
impl<T> Clone for NonEmptySlice<T> {
fn clone(&self) -> Self {
*self
}
}
impl<T> NonEmptySlice<T> {
pub const fn start(self) -> u32 {
self.inner.start()