You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Jared Fowler edited this page Apr 14, 2018
·
1 revision
examples
example sketch of how this crate is used:
A crate for the binary, which imports a crate (the lib); using like this?
src/main.rs
externcrate awl;use awl::Awl;fnmain(){println!("awl is a tool to punch holes with.");let a = Awl{ip_addr:"127.0.0.1".to_string(),port:1337};
a.my_ip();}
and in src/lib.rs, we declare the Awl struct that implements client and server methods:
/// Main constructor.pubstructAwl{pubip_addr:String,pubport:u16,}implAwl{pubfnmy_ip(&self){println!("My IP is {}",self.ip_addr);}}/// client / server / connnections here or created as own mods (probably better) and imported