pkstrings: Remove From<u8> impl

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2021-11-15 18:45:44 +01:00
parent 891f05c271
commit fc8786dae9
Signed by: pep
GPG key ID: DEDA74AEECA9D0F2
2 changed files with 0 additions and 25 deletions

View file

@ -140,18 +140,6 @@ impl fmt::Display for PKString {
}
}
impl TryFrom<u8> for PKString {
type Error = Error;
fn try_from(ord: u8) -> Result<PKString, Error> {
if in_range(ord) {
Ok(PKString(vec![ord]))
} else {
Err(Error::InvalidByte(ord))
}
}
}
impl TryFrom<&[u8]> for PKString {
type Error = Error;

View file

@ -20,19 +20,6 @@ const GARY_SLICE_U8: &[u8] = &[0x86, 0x80, 0x91, 0x98];
const GARY_STR: &str = "GARY";
const INVALID_BYTE: u8 = 0x01;
#[test]
fn test_try_from_u8() {
match PKString::try_from(0x80) { // 'A'
Ok(pkstr) => assert_eq!(pkstr, PKString::try_from("A").unwrap()),
Err(_) => panic!(),
}
match PKString::try_from(INVALID_BYTE) {
Ok(_) => panic!(),
Err(_) => (),
}
}
#[test]
fn test_try_from_slice_u8() {
match PKString::try_from(GARY_SLICE_U8) {