#weight #stream #priority #select

weighted-select

futures::stream::Select with weights

2 releases

0.1.1 Apr 13, 2019
0.1.0 Apr 13, 2019

#29 in #select

MIT license

11KB
248 lines

weighted-select

Usage:

use weighted_select::{self, IncompleteSelect};

let select = weighted_select::new()
    .append(fetch_from_a, 5)
    .append(fetch_from_b, 2)
    .append(fetch_from_c, 3)
    .build();

It produces a stream that combines three underlying streams (fetch_from_*) and polls them according to their weights (5, 2, 3). Each stream will be polled at most weight times consecutively.

Dependencies

~54KB