Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/haraldh/dynqueue
dynamically extendable Rayon parallel iterator
https://github.com/haraldh/dynqueue
Last synced: 4 months ago
JSON representation
dynamically extendable Rayon parallel iterator
- Host: GitHub
- URL: https://github.com/haraldh/dynqueue
- Owner: haraldh
- License: mit
- Created: 2020-03-12T08:53:44.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-10-12T08:55:46.000Z (over 4 years ago)
- Last Synced: 2024-09-14T09:39:05.714Z (5 months ago)
- Language: Rust
- Homepage:
- Size: 19.5 KB
- Stars: 9
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Rust](https://github.com/haraldh/dynqueue/workflows/Rust/badge.svg)](https://github.com/haraldh/dynqueue/actions)
[![Coverage Status](https://coveralls.io/repos/github/haraldh/dynqueue/badge.svg?branch=master)](https://coveralls.io/github/haraldh/dynqueue?branch=master)# DynQueue - dynamically extendable Rayon parallel iterator
A `DynQueue` can be iterated with `into_par_iter` producing `(DynQueueHandle, T)` elements.
With the `DynQueueHandle` a new `T` can be inserted in the `DynQueue`,
which is currently iterated over.A `Vec`, `VecDeque` and `crossbeam_queue::SegQueue` (with `feature = "crossbeam-queue"`)
can be turned into a `DynQueue` with `.into_dyn_queue()`.```rust
use rayon::iter::IntoParallelIterator as _;
use rayon::iter::ParallelIterator as _;use dynqueue::IntoDynQueue as _;
fn main() {
let mut result = vec![1, 2, 3]
.into_dyn_queue()
.into_par_iter()
.map(|(handle, value)| { if value == 2 { handle.enqueue(4) }; value })
.collect::>();
result.sort();assert_eq!(result, vec![1, 2, 3, 4]);
}
```## Features
* `crossbeam-queue` : to use `crossbeam::queue::SegQueue` as the inner collection.
## Changelog
### 0.2.0
- introduce `IntoDynQueue`
- handle lockless collections### 0.1.0
- initial version