pub struct Connection {
pub reader: BufReader<NetStream>,
pub writer: BufWriter<NetStream>,
/* private fields */
}
Expand description
A Connection object. Make sure you syncronize if uses in multiple threads
Fields§
§reader: BufReader<NetStream>
BufReader for NetStream (TCP/SSL)
writer: BufWriter<NetStream>
BufWriter for NetStream (TCP/SSL)
Implementations§
Source§impl Connection
Implementation for Connectio
impl Connection
Implementation for Connectio
pub fn get_peer_address(&self) -> &String
pub fn get_local_address(&self) -> &String
Sourcepub fn connect(config: &Config) -> Result<Connection>
pub fn connect(config: &Config) -> Result<Connection>
connection unique id Creates a TCP connection to the specified server.
Sourcepub fn reconnect(&mut self) -> Result<Connection>
pub fn reconnect(&mut self) -> Result<Connection>
Creates a TCP/SSL connection to the specified server. If already connected, it will drop and reconnect
Auto Trait Implementations§
impl Freeze for Connection
impl RefUnwindSafe for Connection
impl Send for Connection
impl Sync for Connection
impl Unpin for Connection
impl UnwindSafe for Connection
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more