about summary refs log tree commit diff
path: root/users/tazjin/german-string/src/lib.rs
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2024-08-16T22·51+0300
committerclbot <clbot@tvl.fyi>2024-08-19T13·19+0000
commitab6a4815ffe84f38bfc0ce5dd5c0a36970009d90 (patch)
tree2d73b270737f8761717182be758f2d4a236c6acb /users/tazjin/german-string/src/lib.rs
parent2284c00417260c3aebb9f022629ded9a64a9ca7e (diff)
feat(tazjin/german-string): add Debug implementation r/8529
Change-Id: I9a4a8a4815ac210c402cfc2feb1fe0606affb327
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12239
Autosubmit: tazjin <tazjin@tvl.su>
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Diffstat (limited to 'users/tazjin/german-string/src/lib.rs')
-rw-r--r--users/tazjin/german-string/src/lib.rs7
1 files changed, 7 insertions, 0 deletions
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::*;