• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

vortex-data / vortex / 16361792489

18 Jul 2025 03:56AM UTC coverage: 81.02% (+0.04%) from 80.979%
16361792489

Pull #3792

github

web-flow
Merge 629e484d6 into 73e365cd9
Pull Request #3792: Vortex - C++ API

30 of 41 new or added lines in 3 files covered. (73.17%)

7 existing lines in 1 file now uncovered.

42055 of 51907 relevant lines covered (81.02%)

168806.9 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/vortex-array/src/stream/to_iterator.rs
1
// SPDX-License-Identifier: Apache-2.0
2
// SPDX-FileCopyrightText: Copyright the Vortex contributors
3

4
use std::future::Future;
5

6
use futures_util::StreamExt;
7
use vortex_dtype::DType;
8
use vortex_error::VortexResult;
9

10
use super::ArrayStream;
11
use crate::ArrayRef;
12
use crate::iter::ArrayIterator;
13

14
/// Trait for abstracting over async runtimes
15
pub trait AsyncRuntime {
16
    /// Block on a future until it completes
17
    fn block_on<F: Future>(&self, fut: F) -> F::Output;
18
}
19

20
/// Adapter for converting an [`ArrayStream`] into an [`ArrayIterator`].
21
///
22
/// This struct allows you to bridge the gap between async stream processing
23
/// and synchronous iterator processing by using a provided async runtime.
24
pub struct ArrayStreamToIterator<S, AR> {
25
    stream: S,
26
    runtime: AR,
27
}
28

29
impl<S, AR> ArrayStreamToIterator<S, AR>
30
where
31
    S: ArrayStream + Unpin + Send,
32
    AR: AsyncRuntime,
33
{
34
    /// Create a new adapter with the given stream and runtime
NEW
35
    pub fn new(stream: S, runtime: AR) -> Self {
×
NEW
36
        Self { stream, runtime }
×
NEW
37
    }
×
38
}
39

40
impl<S, AR> ArrayIterator for ArrayStreamToIterator<S, AR>
41
where
42
    S: ArrayStream + Unpin + Send,
43
    AR: AsyncRuntime,
44
{
NEW
45
    fn dtype(&self) -> &DType {
×
NEW
46
        self.stream.dtype()
×
NEW
47
    }
×
48
}
49

50
impl<S, AR> Iterator for ArrayStreamToIterator<S, AR>
51
where
52
    S: ArrayStream + Unpin + Send,
53
    AR: AsyncRuntime,
54
{
55
    type Item = VortexResult<ArrayRef>;
56

NEW
57
    fn next(&mut self) -> Option<Self::Item> {
×
NEW
58
        self.runtime.block_on(self.stream.next())
×
NEW
59
    }
×
60
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc