mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
Merge branch 'main' into specialize-exprs
This commit is contained in:
commit
2e96aca0fd
797 changed files with 17394 additions and 12632 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue