Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for step_trait #1041

Open
nazar-pc opened this issue Apr 11, 2023 · 3 comments
Open

Support for step_trait #1041

nazar-pc opened this issue Apr 11, 2023 · 3 comments

Comments

@nazar-pc
Copy link

Nightly has a step_trait feature supporting Step trait implementation for custom types, I have new types that implement it, but can't use with rayon directly and have to convert fo/from std integers. Would be nice to support it (behind nightly feature).

rust-lang/rust#42168

@cuviper
Copy link
Member

cuviper commented Apr 11, 2023

Even the current Range parallel implementations are a bit different between "indexed" (up to u32) and not, and I don't think the Step trait would be enough to cover that kind of difference for generic types. But couldn't you implement ParallelIterator yourself in your specific domain?

(I'm not keen to have a "nightly" feature in general...)

@nazar-pc
Copy link
Author

The goal would be to write (S::ZERO..).into_par_iter().take(200) rather than custom syntax. And I can't implement IntoParalellIterator for Range myself due to the way Rust rules around impls of foreign traits for foreign types work.

@cuviper
Copy link
Member

cuviper commented Apr 11, 2023

It's possible we could design our own Step trait that meets our needs and allows third-party Range<T> parallelization. There's some abstraction right now in the private RangeInteger here, but I don't think that's what we would want a public interface to look like.

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

No branches or pull requests

2 participants