Commit 6c74d27
authored
Implement basic combinators map, filter and filter_map for irpc channels. (#68)
I find these useful quite a few times. They already exist on Sink and
Stream of course, but often you don't want to convert your senders and
receivers into Sink / Stream and lose the extra fns. Also Sink API is
just weird!
In the fns that filter (with_filter, with_filter_map, filter,
filter_map) the item is just dropped if it does not match the filter. I
think for these channels this is uncontroversial, besides SinkExt does
the same. It does not produce an error if you use e.g.
[with_flat_map](https://docs.rs/futures/latest/futures/sink/trait.SinkExt.html#method.with_flat_map)
to map to an empty stream.
An additional change is that the bounds for
crate::channel::mpsc::Sender/Receiver are reduced so you can now use a
crate::channel::mpsc::Sender/Receiver as the channel to an actor even
for messages that are not serializable.1 parent 99df1dd commit 6c74d27
3 files changed
+296
-89
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
| 58 | + | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| |||
0 commit comments