NLnetLabs / domain

A DNS library for Rust.

Home Page:https://nlnetlabs.nl/projects/domain/about/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mistake in Dname::from_slice doc example

zacknewman opened this issue · comments

Despite the documentation which states the slice must be in wire format (which of course means must contain the root label among other things), the example provided for Dname::from_slice leads to an Err due to the missing root label. Specifically, the example should be changed to Dname::from_slice(b"\x07example\x03com\x00");; or if that was intentional to show that it's an error, it should be changed to something like assert!(Dname::from_slice(b"\x07example\x03com").map_or_else(|e| e == DnameError::RelativeName, |_| false)); emphasizing it's an error and why.

Thanks for report! This is definitely a mistake in the documentation.