Skip to content

Commit

Permalink
iterutil crate
Browse files Browse the repository at this point in the history
  • Loading branch information
scsmithr committed Dec 21, 2024
1 parent 6792fbb commit 95981e0
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions crates/iterutil/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[package]
name = "iterutil"
version.workspace = true
edition.workspace = true

[dependencies]
25 changes: 25 additions & 0 deletions crates/iterutil/src/exact_size.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/// Similar to `IntoIterator`, but for an iterator with an exact size.
pub trait IntoExactSizeIterator {
type Item;
type IntoIter: ExactSizeIterator<Item = Self::Item>;

/// Converts self into the `ExactSizeIteror`.
fn into_iter(self) -> Self::IntoIter;
}

impl<I> IntoExactSizeIterator for I
where
I: IntoIterator,
I::IntoIter: ExactSizeIterator,
{
type Item = I::Item;
type IntoIter = I::IntoIter;

fn into_iter(self) -> Self::IntoIter {
self.into_iter()
}
}

pub trait FromExactSizeIterator<A>: Sized {
fn from_iter<T: IntoExactSizeIterator<Item = A>>(iter: T) -> Self;
}
1 change: 1 addition & 0 deletions crates/iterutil/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod exact_size;
1 change: 1 addition & 0 deletions crates/rayexec_execution/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ rayexec_parser = { path = "../rayexec_parser" }
rayexec_bullet = { path = "../rayexec_bullet" }
rayexec_io = { path = "../rayexec_io" }
fmtutil = { path = "../fmtutil" }
iterutil = { path = "../iterutil" }
# stackutil = { path = "../stackutil" } TODO: psm hash issues when compiling to wasm on macos

ahash = { workspace = true }
Expand Down
1 change: 1 addition & 0 deletions crates/rayexec_execution/src/arrays/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions crates/rayexec_execution/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pub mod arrays;
pub mod config;
pub mod database;
pub mod datasource;
Expand Down

0 comments on commit 95981e0

Please sign in to comment.