pkstrings: Remove From<u8> impl
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
parent
891f05c271
commit
fc8786dae9
2 changed files with 0 additions and 25 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue