pub fn try_push(&mut self, code: u16, data: &[u8]) -> Result<(), RdataTooLongError> {
        if self.octets_written + 4 + data.len() > (u16::MAX as usize) {
            Err(RdataTooLongError)
        } else {
            self.buf.reserve(4 + data.len());
            self.buf.extend_from_slice(&code.to_be_bytes());
            self.buf
                .extend_from_slice(&(data.len() as u16).to_be_bytes());
            self.buf.extend_from_slice(data);
            self.octets_written += 4 + data.len();
            Ok(())
        }
    }
/// Attempts to serialize an additional EDNS option into the
/// underlying buffer. If this would exceed the maximum RDATA length
/// of 65,535 octets, then this will fail.
Attempts to serialize an additional EDNS option into the
underlying buffer. If this would exceed the maximum RDATA length
of 65,535 octets, then this will fail.
Attempts to serialize an additional EDNS option into the underlying buffer . If this would exceed the maximum RDATA length of 65 535 octets then this will fail .
pub fn try_push(&mut self, code: u16, data: &[u8]) -> Result<(), RdataTooLongError> {
        if self.octets_written + 4 + data.len() > (u16::MAX as usize) {
            Err(RdataTooLongError)
        } else {
            self.buf.reserve(4 + data.len());
            self.buf.extend_from_slice(&code.to_be_bytes());
            self.buf
                .extend_from_slice(&(data.len() as u16).to_be_bytes());
            self.buf.extend_from_slice(data);
            self.octets_written += 4 + data.len();
            Ok(())
        }
    }
pub fn try_push ( & mut self , code : u16 , data : & [ u8 ] ) -> Result < ( ) , RdataTooLongError > { if self . octets_written + 4 + data . len ( ) > ( u16 :: MAX as usize ) { Err ( RdataTooLongError ) } else { self . buf . reserve ( 4 + data . len ( ) ) ; self . buf . extend_from_slice ( & code . to_be_bytes ( ) ) ; self . buf . extend_from_slice ( & ( data . len ( ) as u16 ) . to_be_bytes ( ) ) ; self . buf . extend_from_slice ( data ) ; self . octets_written += 4 + data . len ( ) ; Ok ( ( ) ) } }
Attempts to serialize an additional EDNS option into the
underlying buffer.
Attempts to serialize an additional EDNS option into the underlying buffer .
&mut self
code
u16
data
&[u8]
&mut self
code
u16
data
&[u8]