-
-
Save TheOpenDevProject/74493b1b806c9b674e3aa3aca25f2f81 to your computer and use it in GitHub Desktop.
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
extern crate ws; | |
use self::ws::listen; | |
pub struct DiscordConnectionInfo<'a> { | |
pub server_url: &'a str, | |
} | |
pub struct DiscordConnectionManager<'a> { | |
conn_inf: DiscordConnectionInfo, | |
} | |
impl DiscordConnectionManager { | |
/// | |
pub fn new<'a>(connection_info: DiscordConnectionInfo) -> Self { | |
DiscordConnectionManager { conn_inf: connection_info } | |
} | |
pub fn connect(&mut self) { | |
listen(self.conn_inf.server_url, |out| { | |
move |msg| { | |
out.send(msg); | |
} | |
}) | |
.unwrap(); | |
} | |
pub fn print_connection_info(&mut self) { | |
println!("Output is:{:?}", self.conn_inf.server_url); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment