From ab6a4815ffe84f38bfc0ce5dd5c0a36970009d90 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 17 Aug 2024 01:51:13 +0300 Subject: feat(tazjin/german-string): add Debug implementation Change-Id: I9a4a8a4815ac210c402cfc2feb1fe0606affb327 Reviewed-on: https://cl.tvl.fyi/c/depot/+/12239 Autosubmit: tazjin Reviewed-by: tazjin Tested-by: BuildkiteCI --- users/tazjin/german-string/src/lib.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'users') diff --git a/users/tazjin/german-string/src/lib.rs b/users/tazjin/german-string/src/lib.rs index cf315c9d5dce..380ca4ed626c 100644 --- a/users/tazjin/german-string/src/lib.rs +++ b/users/tazjin/german-string/src/lib.rs @@ -1,4 +1,5 @@ use std::alloc::Layout; +use std::fmt::{Debug, Formatter}; #[derive(Clone, Copy)] #[repr(C)] @@ -116,6 +117,12 @@ impl PartialEq for GermanString { } } +impl Debug for GermanString { + fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> { + String::from_utf8_lossy(self.as_bytes()).fmt(f) + } +} + #[cfg(test)] mod tests { use super::*; -- cgit 1.4.1