1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//! Batch implementations that use channels and threads to support simultaneously receiving items and awaiting on timeouts.
//!
//! This implementations are using `crossbeam_channel` to implement awaiting for items or timeout.

pub mod buf_batch;
pub mod multi_buf_batch;
pub mod tx_buf_batch;

use std::error::Error;
use std::fmt;

/// Error returned by channel based implementations when `Sender` end of
/// channel was dropped and no more outstanding data is left to be provided.
#[derive(PartialEq, Eq, Clone, Copy, Debug)]
pub struct EndOfStreamError;

impl fmt::Display for EndOfStreamError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "no more items will be provided to this batch")
    }
}

impl Error for EndOfStreamError {}