Skip to content

Instantly share code, notes, and snippets.

@TheOpenDevProject
Created October 1, 2016 07:16
Show Gist options
  • Save TheOpenDevProject/74493b1b806c9b674e3aa3aca25f2f81 to your computer and use it in GitHub Desktop.
Save TheOpenDevProject/74493b1b806c9b674e3aa3aca25f2f81 to your computer and use it in GitHub Desktop.
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