pub struct TcpManager { /* private fields */ }Expand description
Actor-style TCP manager. Drop the handle (or call Self::shutdown)
to stop it.
Implementations§
Source§impl TcpManager
impl TcpManager
Sourcepub fn spawn() -> (Self, UnboundedReceiver<IoEvent>)
pub fn spawn() -> (Self, UnboundedReceiver<IoEvent>)
Spawn the manager and return the command handle + event stream.
pub fn bind(&self, addr: SocketAddr) -> Result<()>
Sourcepub fn connect(&self, addr: SocketAddr) -> Result<()>
pub fn connect(&self, addr: SocketAddr) -> Result<()>
Initiate an outbound connection. On success the manager
publishes IoEvent::Connected { id, peer }; on failure it
publishes IoEvent::Error { reason }.
pub fn send_bytes(&self, id: ConnId, bytes: Vec<u8>) -> Result<()>
pub fn close(&self, id: ConnId) -> Result<()>
pub fn shutdown(&self)
Auto Trait Implementations§
impl Freeze for TcpManager
impl RefUnwindSafe for TcpManager
impl Send for TcpManager
impl Sync for TcpManager
impl Unpin for TcpManager
impl UnsafeUnpin for TcpManager
impl UnwindSafe for TcpManager
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