pub fn next_rr(&mut self) -> Result<Option<ResourceRecord>, Error<W5500::Error>> {
        if self.rr_idx >= self.rr_count() {
            Ok(None)
        } else {
            self.rr_idx = self.rr_idx.saturating_add(1);

            let name: Option<&str> = read_labels(&mut self.reader, self.buf)?;

            let qtype = read_u16(&mut self.reader)?;
            let class = read_u16(&mut self.reader)?;
            let ttl = read_u32(&mut self.reader)?;
            let rdlength = read_u16(&mut self.reader)?;

            let qtype = qtype.try_into();

            let before_rdata_pos = self.reader.stream_position();

            let rdata = match qtype {
                Ok(Qtype::A) => {
                    let mut buf: [u8; 4] = [0; 4];
                    self.reader.read_exact(&mut buf)?;
                    RData::A(Ipv4Addr::from(buf))
                }
                Ok(Qtype::SVR) => {
                    let priority = read_u16(&mut self.reader)?;
                    let weight = read_u16(&mut self.reader)?;
                    let port = read_u16(&mut self.reader)?;
                    RData::SVR(ServiceData {
                        priority,
                        weight,
                        port,
                    })
                }
                _ => RData::Unsupported,
            };

            if rdlength != 0 {
                self.reader
                    .seek(SeekFrom::Start(before_rdata_pos.saturating_add(rdlength)))?;
            }

            // now we are at the rest of the answer.
            Ok(Some(ResourceRecord {
                name,
                qtype,
                class: class.try_into(),
                ttl,
                rdata,
            }))
        }
    }
/// Get the next resource record from the DNS response.
///
/// # Errors
///
/// This method can only return:
///
/// * [`Error::Other`]
/// * [`Error::UnexpectedEof`]
///
/// If any error occurs the entire response should be discarded,
/// and you should not continue to call `next_rr`.
Get the next resource record from the DNS response.
Get the next resource record from the DNS response .
pub fn next_rr(&mut self) -> Result<Option<ResourceRecord>, Error<W5500::Error>> {
        if self.rr_idx >= self.rr_count() {
            Ok(None)
        } else {
            self.rr_idx = self.rr_idx.saturating_add(1);
            let name: Option<&str> = read_labels(&mut self.reader, self.buf)?;
            let qtype = read_u16(&mut self.reader)?;
            let class = read_u16(&mut self.reader)?;
            let ttl = read_u32(&mut self.reader)?;
            let rdlength = read_u16(&mut self.reader)?;
            let qtype = qtype.try_into();
            let before_rdata_pos = self.reader.stream_position();
            let rdata = match qtype {
                Ok(Qtype::A) => {
                    let mut buf: [u8; 4] = [0; 4];
                    self.reader.read_exact(&mut buf)?;
                    RData::A(Ipv4Addr::from(buf))
                }
                Ok(Qtype::SVR) => {
                    let priority = read_u16(&mut self.reader)?;
                    let weight = read_u16(&mut self.reader)?;
                    let port = read_u16(&mut self.reader)?;
                    RData::SVR(ServiceData {
                        priority,
                        weight,
                        port,
                    })
                }
                _ => RData::Unsupported,
            };
            if rdlength != 0 {
                self.reader
                    .seek(SeekFrom::Start(before_rdata_pos.saturating_add(rdlength)))?;
            }
            // now we are at the rest of the answer.
            Ok(Some(ResourceRecord {
                name,
                qtype,
                class: class.try_into(),
                ttl,
                rdata,
            }))
        }
    }
pub fn next_rr ( & mut self ) -> Result < Option < ResourceRecord > , Error < W5500 :: Error > > { if self . rr_idx >= self . rr_count ( ) { Ok ( None ) } else { self . rr_idx = self . rr_idx . saturating_add ( 1 ) ; let name : Option < & str > = read_labels ( & mut self . reader , self . buf ) ? ; let qtype = read_u16 ( & mut self . reader ) ? ; let class = read_u16 ( & mut self . reader ) ? ; let ttl = read_u32 ( & mut self . reader ) ? ; let rdlength = read_u16 ( & mut self . reader ) ? ; let qtype = qtype . try_into ( ) ; let before_rdata_pos = self . reader . stream_position ( ) ; let rdata = match qtype { Ok ( Qtype :: A ) => { let mut buf : [ u8 ; 4 ] = [ 0 ; 4 ] ; self . reader . read_exact ( & mut buf ) ? ; RData :: A ( Ipv4Addr :: from ( buf ) ) } Ok ( Qtype :: SVR ) => { let priority = read_u16 ( & mut self . reader ) ? ; let weight = read_u16 ( & mut self . reader ) ? ; let port = read_u16 ( & mut self . reader ) ? ; RData :: SVR ( ServiceData { priority , weight , port , } ) } _ => RData :: Unsupported , } ; if rdlength != 0 { self . reader . seek ( SeekFrom :: Start ( before_rdata_pos . saturating_add ( rdlength ) ) ) ? ; } // now we are at the rest of the answer. Ok ( Some ( ResourceRecord { name , qtype , class : class . try_into ( ) , ttl , rdata , } ) ) } }
Get the next resource record from the DNS response.
Get the next resource record from the DNS response .
&mut self
&mut self
errors
This method can only return.

[`Error::Other`]
[`Error::UnexpectedEof`]

If any error occurs the entire response should be discarded,
and you should not continue to call `next_rr`.
This method can only return . [ ` Error :: Other ` ] [ ` Error :: UnexpectedEof ` ] If any error occurs the entire response should be discarded and you should not continue to call ` next_rr ` .