/rust/registry/src/index.crates.io-6f17d22bba15001f/bytes-1.10.0/src/fmt/hex.rs
Line | Count | Source (jump to first uncovered line) |
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 | 0 | fn fmt(&self, f: &mut Formatter<'_>) -> Result { |
8 | 0 | for &b in self.0 { |
9 | 0 | write!(f, "{:02x}", b)?; |
10 | | } |
11 | 0 | Ok(()) |
12 | 0 | } |
13 | | } |
14 | | |
15 | | impl UpperHex for BytesRef<'_> { |
16 | 0 | fn fmt(&self, f: &mut Formatter<'_>) -> Result { |
17 | 0 | for &b in self.0 { |
18 | 0 | write!(f, "{:02X}", b)?; |
19 | | } |
20 | 0 | Ok(()) |
21 | 0 | } |
22 | | } |
23 | | |
24 | | fmt_impl!(LowerHex, Bytes); |
25 | | fmt_impl!(LowerHex, BytesMut); |
26 | | fmt_impl!(UpperHex, Bytes); |
27 | | fmt_impl!(UpperHex, BytesMut); |