pub fn send(&mut self, size: usize, endpoint: IpEndpoint) -> Result<&mut [u8]> {
        if self.endpoint.port == 0 { return Err(Error::Unaddressable) }
        if !endpoint.is_specified() { return Err(Error::Unaddressable) }

        let packet_buf = self.tx_buffer.enqueue_one_with(|buf| buf.resize(size))?;
        packet_buf.endpoint = endpoint;
        net_trace!("{}:{}:{}: buffer to send {} octets",
                   self.meta.handle, self.endpoint, packet_buf.endpoint, size);
        Ok(&mut packet_buf.as_mut()[..size])
    }
/// Enqueue a packet to be sent to a given remote endpoint, and return a pointer
/// to its payload.
///
/// This function returns `Err(Error::Exhausted)` if the transmit buffer is full,
/// `Err(Error::Truncated)` if the requested size is larger than the packet buffer
/// size, and `Err(Error::Unaddressable)` if local or remote port, or remote address,
/// are unspecified.
Enqueue a packet to be sent to a given remote endpoint, and return a pointer
to its payload.


Enqueue a packet to be sent to a given remote endpoint and return a pointer to its payload .
pub fn send(&mut self, size: usize, endpoint: IpEndpoint) -> Result<&mut [u8]> {
        if self.endpoint.port == 0 { return Err(Error::Unaddressable) }
        if !endpoint.is_specified() { return Err(Error::Unaddressable) }
        let packet_buf = self.tx_buffer.enqueue_one_with(|buf| buf.resize(size))?;
        packet_buf.endpoint = endpoint;
        net_trace!("{}:{}:{}: buffer to send {} octets",
                   self.meta.handle, self.endpoint, packet_buf.endpoint, size);
        Ok(&mut packet_buf.as_mut()[..size])
    }
pub fn send ( & mut self , size : usize , endpoint : IpEndpoint ) -> Result < & mut [ u8 ] > { if self . endpoint . port == 0 { return Err ( Error :: Unaddressable ) } if ! endpoint . is_specified ( ) { return Err ( Error :: Unaddressable ) } let packet_buf = self . tx_buffer . enqueue_one_with ( | buf | buf . resize ( size ) ) ? ; packet_buf . endpoint = endpoint ; net_trace ! ( " " self meta handle self endpoint packet_buf endpoint size ) ; Ok ( & mut packet_buf . as_mut ( ) [ .. size ] ) }
Enqueue a packet to be sent to a given remote endpoint, and return a pointer
to its payload.
Enqueue a packet to be sent to a given remote endpoint and return a pointer to its payload .
&mut self
size
usize
endpoint
IpEndpoint
&mut self
size
usize
endpoint
IpEndpoint