• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 pub mod hex;
2 pub mod thread_id;
3 
4 /// Lightweight wrapper around `&[u8]` which denotes that the contained data is
5 /// a ASCII string.
6 #[derive(Debug)]
7 #[repr(transparent)]
8 pub struct Bstr<'a>(&'a [u8]);
9 
10 impl<'a> From<&'a [u8]> for Bstr<'a> {
from(s: &'a [u8]) -> Bstr<'a>11     fn from(s: &'a [u8]) -> Bstr<'a> {
12         Bstr(s)
13     }
14 }
15 
16 impl<'a> From<Bstr<'a>> for &'a [u8] {
from(s: Bstr<'a>) -> &'a [u8]17     fn from(s: Bstr<'a>) -> &'a [u8] {
18         s.0
19     }
20 }
21 
22 impl AsRef<[u8]> for Bstr<'_> {
as_ref(&self) -> &[u8]23     fn as_ref(&self) -> &[u8] {
24         self.0
25     }
26 }
27