Skip to main content

oxirs_arq/streaming/
emptystream_traits.rs

1//! # EmptyStream - Trait Implementations
2//!
3//! This module contains trait implementations for `EmptyStream`.
4//!
5//! ## Implemented Traits
6//!
7//! - `DataStream`
8//!
9//! 🤖 Generated with [SplitRS](https://github.com/cool-japan/splitrs)
10
11use crate::algebra::Solution;
12use anyhow::Result;
13
14use super::functions::DataStream;
15use super::types::{EmptyStream, StreamStats};
16
17impl DataStream for EmptyStream {
18    fn next_batch(&mut self) -> Result<Option<Vec<Solution>>> {
19        if self.exhausted {
20            Ok(None)
21        } else {
22            self.exhausted = true;
23            Ok(Some(vec![]))
24        }
25    }
26    fn has_more(&self) -> bool {
27        !self.exhausted
28    }
29    fn estimated_size(&self) -> Option<usize> {
30        Some(0)
31    }
32    fn reset(&mut self) -> Result<()> {
33        self.exhausted = false;
34        Ok(())
35    }
36    fn get_stats(&self) -> StreamStats {
37        StreamStats::default()
38    }
39}