diff --git a/candid_client/src/candid_connection.rs b/candid_client/src/candid_connection.rs new file mode 100644 index 0000000..fa5ef3f --- /dev/null +++ b/candid_client/src/candid_connection.rs @@ -0,0 +1,16 @@ +use std::io::BufReader; +use std::net::{TcpStream, ToSocketAddrs}; + +pub struct CandidConnection { + stream: BufReader, +} + +impl CandidConnection { + pub fn new(addr: A) -> Result { + let stream = TcpStream::connect(addr)?; + + Ok(CandidConnection { + stream: BufReader::new(stream), + }) + } +} diff --git a/candid_client/src/lib.rs b/candid_client/src/lib.rs new file mode 100644 index 0000000..e9ef90e --- /dev/null +++ b/candid_client/src/lib.rs @@ -0,0 +1 @@ +pub mod candid_connection; diff --git a/candid_client/src/main.rs b/candid_client/src/main.rs index c37239b..ef9e709 100644 --- a/candid_client/src/main.rs +++ b/candid_client/src/main.rs @@ -4,6 +4,8 @@ use std::net::TcpStream; use clap::{App, Arg}; +extern crate candid_client; + fn main() { let matches = App::new("CANdid Client") .version("0.1.0")