1use core::fmt::{Formatter, LowerHex, Result, UpperHex};
2
3use super::BytesRef;
4use crate::{Bytes, BytesMut};
5
6impl LowerHex for BytesRef<'_> {
7 fn fmt(&self, f: &mut Formatter<'_>) -> Result {
8 for &b in self.0 {
9 write!(f, "{:02x}", b)?;
10 }
11 Ok(())
12 }
13}
14
15impl UpperHex for BytesRef<'_> {
16 fn fmt(&self, f: &mut Formatter<'_>) -> Result {
17 for &b in self.0 {
18 write!(f, "{:02X}", b)?;
19 }
20 Ok(())
21 }
22}
23
24fmt_impl!(LowerHex, Bytes);
25fmt_impl!(LowerHex, BytesMut);
26fmt_impl!(UpperHex, Bytes);
27fmt_impl!(UpperHex, BytesMut);