pub struct Client { /* private fields */ }
Expand description
A client for sending and receiving data.
Implementations§
Source§impl Client
impl Client
pub fn from_stream(stream: TcpStream) -> Self
pub fn from_arcmutex_socket(stream: Arc<Mutex<TcpStream>>) -> Self
pub fn connect<T: ToSocketAddrs>(addr: T) -> Result<Client>
Sourcepub fn with_config(self, config: &SocketConfig) -> Result<Self>
pub fn with_config(self, config: &SocketConfig) -> Result<Self>
Applies the configuration to the socket.
Sourcepub fn recv(&mut self) -> Result<()>
pub fn recv(&mut self) -> Result<()>
Receives data from the socket. This does not return anything, but instead stores the data in the stream.
pub fn stream<T>(&mut self) -> Stream<T>where
T: Sendable + 'static,
pub fn listen(&mut self) -> Result<()>
pub fn stop_listening(&mut self)
pub fn error(&self) -> Option<Error>
pub fn is_connected(&self) -> bool
pub fn peer_addr(&self) -> Result<SocketAddr>
pub fn set_nonblocking(&self, nonblocking: bool) -> Result<()>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
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