This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Any time a stream resolves a value, a timer is started. | |
/// When the timer finishes, the last value that the stream has resolved during the timer window | |
/// is returned. Any intermediate value is dropped. | |
pub fn low_pass_filter<'a, T: 'a>( | |
stream: futures_util::stream::LocalBoxStream<'a, T>, | |
delay_: std::time::Duration | |
) -> impl futures_util::stream::Stream<Item = Result<T, Error>> + 'a { | |
use futures_util::{future::{Either, LocalBoxFuture, select}, stream::{Stream, StreamExt, StreamFuture, try_unfold}}; | |
use std::{future::Future, marker::Unpin}; |