fn read_query(query: &mut Reader) -> Result<Question, Option<Question>> {
    if query.qdcount() != 1 {
        Err(None)
    } else if let Ok(question) = query.read_question() {
        if query.qr()
            || query.tc()
            || query.ancount() > 0
            || query.nscount() > 0
            || query.arcount() > 0
        {
            Err(Some(question))
        } else {
            Ok(question)
        }
    } else {
        Err(None)
    }
}
/// Reads a query and returns its question. On error, the question is
/// returned only if it could be read.
Reads a query and returns its question. On error, the question is
returned only if it could be read.
Reads a query and returns its question . On error the question is returned only if it could be read .
fn read_query(query: &mut Reader) -> Result<Question, Option<Question>> {
    if query.qdcount() != 1 {
        Err(None)
    } else if let Ok(question) = query.read_question() {
        if query.qr()
            || query.tc()
            || query.ancount() > 0
            || query.nscount() > 0
            || query.arcount() > 0
        {
            Err(Some(question))
        } else {
            Ok(question)
        }
    } else {
        Err(None)
    }
}
fn read_query ( query : & mut Reader ) -> Result < Question , Option < Question > > { if query . qdcount ( ) != 1 { Err ( None ) } else if let Ok ( question ) = query . read_question ( ) { if query . qr ( ) || query . tc ( ) || query . ancount ( ) > 0 || query . nscount ( ) > 0 || query . arcount ( ) > 0 { Err ( Some ( question ) ) } else { Ok ( question ) } } else { Err ( None ) } }
Reads a query and returns its question.
Reads a query and returns its question .
query
&mut Reader
query
&mut Reader