Skip to content

Add array-based chunks and windows from slices#789

Closed
cuviper wants to merge 3 commits intorayon-rs:mainfrom
cuviper:array_chunks
Closed

Add array-based chunks and windows from slices#789
cuviper wants to merge 3 commits intorayon-rs:mainfrom
cuviper:array_chunks

Conversation

@cuviper
Copy link
Copy Markdown
Member

@cuviper cuviper commented Aug 17, 2020

pub trait ParallelSlice<T: Sync> {
    fn par_array_windows<const N: usize>(&self) -> ArrayWindows<'_, T, N>;
    fn par_array_chunks<const N: usize>(&self) -> ArrayChunks<'_, T, N>;
}
pub trait ParallelSliceMut<T: Send> {
    fn par_array_chunks_mut<const N: usize>(&mut self) -> ArrayChunksMut<'_, T, N>;
}

Comment thread src/slice/mod.rs
Comment thread src/slice/mod.rs Outdated
@cuviper cuviper force-pushed the array_chunks branch 2 times, most recently from 95c3f6c to b43b311 Compare February 25, 2021 22:15
@cuviper cuviper force-pushed the array_chunks branch 2 times, most recently from d4dd19e to 218cb66 Compare March 26, 2021 20:20
Copy link
Copy Markdown
Member

@nikomatsakis nikomatsakis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good!

@cuviper
Copy link
Copy Markdown
Member Author

cuviper commented Apr 1, 2021

My only hesitation is to wait for std stabilization: rust-lang/rust#74985 and rust-lang/rust#75027

@pittengermd
Copy link
Copy Markdown

Any update on when this pull request might be merged? I would love to use this for video format conversion.

@cuviper
Copy link
Copy Markdown
Member Author

cuviper commented Feb 7, 2022

I'm still hoping std will settle its API, so we can be consistent in how we replicate it here.

@rezat-c
Copy link
Copy Markdown

rezat-c commented Mar 16, 2026

My only hesitation is to wait for std stabilization: rust-lang/rust#74985 and rust-lang/rust#75027

rust-lang/rust#74985 and rust-lang/rust#75027 were closed.

@cuviper
Copy link
Copy Markdown
Member Author

cuviper commented Mar 16, 2026

My only hesitation is to wait for std stabilization: rust-lang/rust#74985 and rust-lang/rust#75027

rust-lang/rust#74985 and rust-lang/rust#75027 were closed.

Right, but the first one (chunks) was closed as not planned, removed in rust-lang/rust#143289. I think the intention is that you can use slice::as_chunks or as_chunks_mut first, then iterate as normal. This ought to work with parallel iterators too, so maybe that's how we should leave it.

Rust 1.94.0 did stabilize array_windows though!

@cuviper
Copy link
Copy Markdown
Member Author

cuviper commented Apr 14, 2026

I published par_array_windows in rayon 1.12.0, and I'm going to close on chunks. If the standard library ever reconsiders, so can we. :)

@cuviper cuviper closed this Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants