smol debug

This commit is contained in:
Aleksey Kladov 2018-08-13 15:44:51 +03:00
parent d19f3ac834
commit 0568e76406

View file

@ -1,6 +1,6 @@
use std::{sync::Arc, ops::Deref};
use std::{sync::Arc, ops::Deref, fmt};
#[derive(Clone, Debug)]
#[derive(Clone)]
pub struct SmolStr(Repr);
impl SmolStr {
@ -49,6 +49,18 @@ impl<'a> PartialEq<SmolStr> for &'a str {
}
}
impl fmt::Debug for SmolStr {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::Debug::fmt(self.as_str(), f)
}
}
impl fmt::Display for SmolStr {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::Display::fmt(self.as_str(), f)
}
}
const INLINE_CAP: usize = 22;
const WS_TAG: u8 = (INLINE_CAP + 1) as u8;