diff options
author | Aleksey Kladov <[email protected]> | 2018-08-13 13:44:51 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-08-13 13:44:51 +0100 |
commit | 0568e76406fc4869152671a255c5e1efca6611a6 (patch) | |
tree | 69aba4bb52795539baa05f048cb4329b47953147 /crates/smol_str | |
parent | d19f3ac83441420365bff5e4ce21d1d2175bd8c2 (diff) |
smol debug
Diffstat (limited to 'crates/smol_str')
-rw-r--r-- | crates/smol_str/src/lib.rs | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/crates/smol_str/src/lib.rs b/crates/smol_str/src/lib.rs index 4d5fef593..41c3a39ef 100644 --- a/crates/smol_str/src/lib.rs +++ b/crates/smol_str/src/lib.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | use std::{sync::Arc, ops::Deref}; | 1 | use std::{sync::Arc, ops::Deref, fmt}; |
2 | 2 | ||
3 | #[derive(Clone, Debug)] | 3 | #[derive(Clone)] |
4 | pub struct SmolStr(Repr); | 4 | pub struct SmolStr(Repr); |
5 | 5 | ||
6 | impl SmolStr { | 6 | impl SmolStr { |
@@ -49,6 +49,18 @@ impl<'a> PartialEq<SmolStr> for &'a str { | |||
49 | } | 49 | } |
50 | } | 50 | } |
51 | 51 | ||
52 | impl fmt::Debug for SmolStr { | ||
53 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | ||
54 | fmt::Debug::fmt(self.as_str(), f) | ||
55 | } | ||
56 | } | ||
57 | |||
58 | impl fmt::Display for SmolStr { | ||
59 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | ||
60 | fmt::Display::fmt(self.as_str(), f) | ||
61 | } | ||
62 | } | ||
63 | |||
52 | const INLINE_CAP: usize = 22; | 64 | const INLINE_CAP: usize = 22; |
53 | const WS_TAG: u8 = (INLINE_CAP + 1) as u8; | 65 | const WS_TAG: u8 = (INLINE_CAP + 1) as u8; |
54 | 66 | ||