Debian Codegraph @

.cargo/vendor/bytes/src/fmt/hex.rs

raw
1 use core::fmt::{Formatter, LowerHex, Result, UpperHex};
2
3 use super::BytesRef;
4 use crate::{Bytes, BytesMut};
5
6 impl 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
15 impl 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
24 fmt_impl!(LowerHex, Bytes);
25 fmt_impl!(LowerHex, BytesMut);
26 fmt_impl!(UpperHex, Bytes);
27 fmt_impl!(UpperHex, BytesMut);