Created
January 30, 2018 20:27
-
-
Save saethlin/b10c0017c69aed2743fc045d92487faf to your computer and use it in GitHub Desktop.
rustfmtpls
This file contains hidden or 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
let runner = ClientBuilder::new(&url) | |
.unwrap() | |
.add_protocol("rust-websocket") | |
.async_connect_secure(None, &core.handle()) | |
.and_then(|(duplex, _)| { | |
let (sink, stream) = duplex.split(); | |
stream.filter_map(|message| { | |
match message { | |
OwnedMessage::Text(t) => { | |
if let Ok(Standard(slackmessage)) = serde_json::from_str::<slack_api::Message>(&t) { | |
if let Some(omnimessage) = thread_handler.to_omni(slackmessage) { | |
thread_sender | |
.send(Event::Message(omnimessage)) | |
.expect("Sender died"); | |
None | |
} else {None} | |
} | |
} | |
OwnedMessage::Close(e) => Some(OwnedMessage::Close(e)), | |
OwnedMessage::Ping(d) => Some(OwnedMessage::Pong(d)), | |
_ => None, | |
} | |
}) | |
//.select(stdin_ch.map_err(|_| WebSocketError::NoDataAvailable)) | |
.forward(sink) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment