From cf2648dde640e7be4d4476fcb4cd8d17cc1ffc37 Mon Sep 17 00:00:00 2001 From: Pantonshire Date: Thu, 18 Aug 2022 11:54:06 +0100 Subject: [PATCH] Seal the encoding::hex::Encode trait --- src/encoding/hex.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/encoding/hex.rs b/src/encoding/hex.rs index 9158bf7..c3f437d 100644 --- a/src/encoding/hex.rs +++ b/src/encoding/hex.rs @@ -85,7 +85,7 @@ impl fmt::Display for HexByte { } } -pub trait Encode { +pub trait Encode: sealed::Sealed { fn byte_to_hex(byte: u8) -> (u8, u8); } @@ -107,6 +107,13 @@ impl Encode for Uppercase { } } +mod sealed { + pub trait Sealed {} + + impl Sealed for super::Lowercase {} + impl Sealed for super::Uppercase {} +} + /// Converts the given byte to its lowercase hexadecimal representation. The first byte returned /// encodes the most significant 4 bits, and the second byte encodes the least significant 4 bits. ///