diff --git a/pkstrings/src/pkstring.rs b/pkstrings/src/pkstring.rs index 12d3792..1b308c9 100644 --- a/pkstrings/src/pkstring.rs +++ b/pkstrings/src/pkstring.rs @@ -222,8 +222,8 @@ impl From for String { } } -// impl PKString { -// fn as_slice(&self) -> &[u8] { -// self.0.as_slice() -// } -// } +impl PKString { + pub fn as_slice(&self) -> &[u8] { + self.0.as_slice() + } +} diff --git a/pkstrings/src/tests.rs b/pkstrings/src/tests.rs index 16cb65f..2d0d543 100644 --- a/pkstrings/src/tests.rs +++ b/pkstrings/src/tests.rs @@ -112,10 +112,9 @@ fn test_from_string() { } } -// #[test] -// fn test_as_slice_u8() { -// let gary: Vec = vec![0x86, 0x80, 0x91, 0x98]; -// let pkstr: PKString = PKString::try_from(gary.clone()).unwrap(); -// let res: &[u8] = pkstr.as_slice(); -// assert_eq!(res, gary.as_slice()); -// } +#[test] +fn test_as_slice_u8() { + let pkstr: PKString = PKString::try_from(GARY_SLICE_U8).unwrap(); + let res: &[u8] = pkstr.as_slice(); + assert_eq!(res, GARY_SLICE_U8); +}