/// Sends data on the socket to the address previously bound via connect().
/// On success, returns the number of bytes written.
///
/// # Panics
///
/// This function will panic if called outside the context of a future's
/// task.
Sends data on the socket to the address previously bound via connect().
On success, returns the number of bytes written.
Sends data on the socket to the address previously bound via connect () . On success returns the number of bytes written .
pub fn send(&mut self, buf: &[u8]) -> io::Result<usize> {
        if let Async::NotReady = self.io.poll_write() {
            return Err(io::ErrorKind::WouldBlock.into())
        }
        match self.io.get_ref().send(buf) {
            Ok(n) => Ok(n),
            Err(e) => {
                if e.kind() == io::ErrorKind::WouldBlock {
                    self.io.need_write()?;
                }
                Err(e)
            }
        }
    }
pub fn send ( & mut self , buf : & [ u8 ] ) -> io :: Result < usize > { if let Async :: NotReady = self . io . poll_write ( ) { return Err ( io :: ErrorKind :: WouldBlock . into ( ) ) } match self . io . get_ref ( ) . send ( buf ) { Ok ( n ) => Ok ( n ) , Err ( e ) => { if e . kind ( ) == io :: ErrorKind :: WouldBlock { self . io . need_write ( ) ? ; } Err ( e ) } } }
Sends data on the socket to the address previously bound via connect().
Sends data on the socket to the address previously bound via connect () .
&mut self
buf
&[u8]
panics
This function will panic if called outside the context of a future's
task.
This function will panic if called outside the context of a future ' s task .