Expand description

Provides an IntervalBuffer that can be used to buffer a stream and emit the values at a regular interval.

This is useful for when you receive streaming data but want to parse it in bulk.

use futures::prelude::*;
use irc::client::prelude::*;
use tokio_interval_buffer::IntervalBuffer;

async fn main() {
    let mut client = Client::from_config(Config {
        nickname: Some(String::from("...")),
        server: Some(String::from("...")),
        channels: vec![String::from("...")],
    .expect("Could not create an irc client");

    // Take the IRC stream and process all the messages every 10 seconds
    let mut buffered_receiver = IntervalBuffer::<_, _, failure::Error>::new(
        client.stream().unwrap().map_err(|e| e.into()),

    while let Some(item) = buffered_receiver.next().await {
        println!("Buffer: {:?}", item);


This buffer takes a stream and an interval, and will emit a VecStream::Item every interval.


A generic component used for the container for the IntervalBuffer. This can be implemented for any type, and is only implemented for Vec by default.