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.
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 anErr
due to the missing root label. Specifically, the example should be changed toDname::from_slice(b"\x07example\x03com\x00");
; or if that was intentional to show that it's an error, it should be changed to something likeassert!(Dname::from_slice(b"\x07example\x03com").map_or_else(|e| e == DnameError::RelativeName, |_| false));
emphasizing it's an error and why.