pub fn dgram_send(&mut self, buf: &[u8]) -> Result<()> {
        let max_payload_len = match self.dgram_max_writable_len() {
            Some(v) => v as usize,
            None => {
                return Err(Error::InvalidState);
            },
        };

        if buf.len() > max_payload_len {
            return Err(Error::BufferTooShort);
        }

        self.dgram_send_queue.push(buf)?;

        if self.dgram_send_queue.byte_size() > self.recovery.cwnd_available() {
            self.recovery.update_app_limited(false);
        }

        Ok(())
    }
/// Sends data in a DATAGRAM frame.
///
/// [`Done`] is returned if no data was written.
/// [`InvalidState`] is returned if the peer does not support DATAGRAM.
/// [`BufferTooShort`] is returned if the DATAGRAM frame length is larger
/// than peer's supported DATAGRAM frame length. Use
/// [`dgram_max_writable_len()`] to get the largest supported DATAGRAM
/// frame length.
///
/// Note that there is no flow control of DATAGRAM frames, so in order to
/// avoid buffering an infinite amount of frames we apply an internal
/// limit.
///
/// [`Done`]: enum.Error.html#variant.Done
/// [`InvalidState`]: enum.Error.html#variant.InvalidState
/// [`BufferTooShort`]: enum.Error.html#variant.BufferTooShort
/// [`dgram_max_writable_len()`]:
/// struct.Connection.html#method.dgram_max_writable_len
///
/// ## Examples:
///
/// ```no_run
/// # let mut buf = [0; 512];
/// # let socket = std::net::UdpSocket::bind("127.0.0.1:0").unwrap();
/// # let mut config = quiche::Config::new(quiche::PROTOCOL_VERSION)?;
/// # let scid = quiche::ConnectionId::from_ref(&[0xba; 16]);
/// # let from = "127.0.0.1:1234".parse().unwrap();
/// # let mut conn = quiche::accept(&scid, None, from, &mut config)?;
/// conn.dgram_send(b"hello")?;
/// # Ok::<(), quiche::Error>(())
/// ```
Sends data in a DATAGRAM frame.
[`Done`] is returned if no data was written.
[`InvalidState`] is returned if the peer does not support DATAGRAM.
[`BufferTooShort`] is returned if the DATAGRAM frame length is larger
than peer's supported DATAGRAM frame length. Use
[`dgram_max_writable_len()`] to get the largest supported DATAGRAM
frame length.

Note that there is no flow control of DATAGRAM frames, so in order to
avoid buffering an infinite amount of frames we apply an internal
limit.


Sends data in a DATAGRAM frame . [ ` Done ` ] is returned if no data was written . [ ` InvalidState ` ] is returned if the peer does not support DATAGRAM . [ ` BufferTooShort ` ] is returned if the DATAGRAM frame length is larger than peer ' s supported DATAGRAM frame length . Use [ ` dgram_max_writable_len () ` ] to get the largest supported DATAGRAM frame length . Note that there is no flow control of DATAGRAM frames so in order to avoid buffering an infinite amount of frames we apply an internal limit .
pub fn dgram_send(&mut self, buf: &[u8]) -> Result<()> {
        let max_payload_len = match self.dgram_max_writable_len() {
            Some(v) => v as usize,
            None => {
                return Err(Error::InvalidState);
            },
        };
        if buf.len() > max_payload_len {
            return Err(Error::BufferTooShort);
        }
        self.dgram_send_queue.push(buf)?;
        if self.dgram_send_queue.byte_size() > self.recovery.cwnd_available() {
            self.recovery.update_app_limited(false);
        }
        Ok(())
    }
pub fn dgram_send ( & mut self , buf : & [ u8 ] ) -> Result < ( ) > { let max_payload_len = match self . dgram_max_writable_len ( ) { Some ( v ) => v as usize , None => { return Err ( Error :: InvalidState ) ; } , } ; if buf . len ( ) > max_payload_len { return Err ( Error :: BufferTooShort ) ; } self . dgram_send_queue . push ( buf ) ? ; if self . dgram_send_queue . byte_size ( ) > self . recovery . cwnd_available ( ) { self . recovery . update_app_limited ( false ) ; } Ok ( ( ) ) }
Sends data in a DATAGRAM frame.
Sends data in a DATAGRAM frame .
&mut self
buf
&[u8]
&mut self
buf
&[u8]
examples:
None
let mut buf = [0; 512];
None
let socket = std::net::udpsocket::bind("127.0.0.1:0").unwrap();
None
let mut config = quiche::config::new(quiche::protocol_version)?;
None
let scid = quiche::connectionid::from_ref(&[0xba; 16]);
None
let from = "127.0.0.1:1234".parse().unwrap();
None
let mut conn = quiche::accept(&scid, none, from, &mut config)?;
None
ok::<(), quiche::error>(())
None