the `msg` type here is `Message`, don't need `unwrap()`, then wrapping `msg.content` in `Some`, return to fit the `filter_map`'s trait bound: Option<T>
pull/1045/head
0xmingx 2 years ago committed by GitHub
parent 91c3117c2b
commit f62aca2a77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -184,7 +184,7 @@ got = b"6"
let messages = subscriber let messages = subscriber
.into_stream() .into_stream()
.filter_map(|msg| match msg { .filter_map(|msg| match msg {
Ok(msg) if msg.content.len() == 1 => msg.unwrap().content, Ok(msg) if msg.content.len() == 1 => Some(msg.content),
_ => None, _ => None,
}) })
.take(3); .take(3);

Loading…
Cancel
Save