aboutsummaryrefslogtreecommitdiff
path: root/vendor/rayon/src/iter/once.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2024-07-19 15:37:58 +0300
committerValentin Popov <valentin@popov.link>2024-07-19 15:37:58 +0300
commita990de90fe41456a23e58bd087d2f107d321f3a1 (patch)
tree15afc392522a9e85dc3332235e311b7d39352ea9 /vendor/rayon/src/iter/once.rs
parent3d48cd3f81164bbfc1a755dc1d4a9a02f98c8ddd (diff)
downloadfparkan-a990de90fe41456a23e58bd087d2f107d321f3a1.tar.xz
fparkan-a990de90fe41456a23e58bd087d2f107d321f3a1.zip
Deleted vendor folder
Diffstat (limited to 'vendor/rayon/src/iter/once.rs')
-rw-r--r--vendor/rayon/src/iter/once.rs68
1 files changed, 0 insertions, 68 deletions
diff --git a/vendor/rayon/src/iter/once.rs b/vendor/rayon/src/iter/once.rs
deleted file mode 100644
index 5140b6b..0000000
--- a/vendor/rayon/src/iter/once.rs
+++ /dev/null
@@ -1,68 +0,0 @@
-use crate::iter::plumbing::*;
-use crate::iter::*;
-
-/// Creates a parallel iterator that produces an element exactly once.
-///
-/// This admits no parallelism on its own, but it could be chained to existing
-/// parallel iterators to extend their contents, or otherwise used for any code
-/// that deals with generic parallel iterators.
-///
-/// # Examples
-///
-/// ```
-/// use rayon::prelude::*;
-/// use rayon::iter::once;
-///
-/// let pi = (0..1234).into_par_iter()
-/// .chain(once(-1))
-/// .chain(1234..10_000);
-///
-/// assert_eq!(pi.clone().count(), 10_001);
-/// assert_eq!(pi.clone().filter(|&x| x < 0).count(), 1);
-/// assert_eq!(pi.position_any(|x| x < 0), Some(1234));
-/// ```
-pub fn once<T: Send>(item: T) -> Once<T> {
- Once { item }
-}
-
-/// Iterator adaptor for [the `once()` function](fn.once.html).
-#[derive(Clone, Debug)]
-pub struct Once<T: Send> {
- item: T,
-}
-
-impl<T: Send> ParallelIterator for Once<T> {
- type Item = T;
-
- fn drive_unindexed<C>(self, consumer: C) -> C::Result
- where
- C: UnindexedConsumer<Self::Item>,
- {
- self.drive(consumer)
- }
-
- fn opt_len(&self) -> Option<usize> {
- Some(1)
- }
-}
-
-impl<T: Send> IndexedParallelIterator for Once<T> {
- fn drive<C>(self, consumer: C) -> C::Result
- where
- C: Consumer<Self::Item>,
- {
- consumer.into_folder().consume(self.item).complete()
- }
-
- fn len(&self) -> usize {
- 1
- }
-
- fn with_producer<CB>(self, callback: CB) -> CB::Output
- where
- CB: ProducerCallback<Self::Item>,
- {
- // Let `OptionProducer` handle it.
- Some(self.item).into_par_iter().with_producer(callback)
- }
-}