Crates.io | tokio-stream-ext |
lib.rs | tokio-stream-ext |
version | 0.1.5 |
source | src |
created_at | 2021-08-27 14:08:24.652363 |
updated_at | 2021-08-31 15:23:15.839085 |
description | Stream extension with new operators, this will grow over the time |
homepage | |
repository | https://github.com/Alexander89/tokio-stream-ext |
max_upload_size | |
id | 443099 |
size | 13,639 |
Stream extension with new operators, this will grow over the time.
Feel free to contribute!
Debounce a stream until it is sattled over a given duration.
ReceiverStream::new(self.input)
.debounce(Duration::from_millis(80)),
Filters events, similar to the last value.
The initial value is always emitted.
ReceiverStream::new(self.input)
.distinct_until_changed(),
Reactive composing of streams.
switch_map(ReceiverStream::new(keyboard), move |value| {
if value == 'k' {
Some(ReceiverStream::new(gamepad))
} else {
Some(ReceiverStream::new(joystick))
}
});
Collects a value from all streams and switch to a live mode. Every new combination will be emitted from now on.
switch_map(ReceiverStream::new(keyboard), move |value| {
if value == 'k' {
Some(ReceiverStream::new(gamepad))
} else {
Some(ReceiverStream::new(joystick))
}
});