Sha256: 54c05ab7d95d7381e499079d63773fabd2672f3c4929b56b02ab87d4495902b5

Contents?: true

Size: 595 Bytes

Versions: 2

Compression:

Stored size: 595 Bytes

Contents

use core::fmt::{Formatter, LowerHex, Result, UpperHex};

use super::BytesRef;
use crate::{Bytes, BytesMut};

impl LowerHex for BytesRef<'_> {
    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
        for &b in self.0 {
            write!(f, "{:02x}", b)?;
        }
        Ok(())
    }
}

impl UpperHex for BytesRef<'_> {
    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
        for &b in self.0 {
            write!(f, "{:02X}", b)?;
        }
        Ok(())
    }
}

fmt_impl!(LowerHex, Bytes);
fmt_impl!(LowerHex, BytesMut);
fmt_impl!(UpperHex, Bytes);
fmt_impl!(UpperHex, BytesMut);

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wasmtime-29.0.0 ./ext/cargo-vendor/bytes-1.9.0/src/fmt/hex.rs
wasmtime-28.0.0 ./ext/cargo-vendor/bytes-1.9.0/src/fmt/hex.rs