diff options
Diffstat (limited to 'library/core/src/ascii.rs')
| -rw-r--r-- | library/core/src/ascii.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/library/core/src/ascii.rs b/library/core/src/ascii.rs index ef8e4d098ed..02867789b79 100644 --- a/library/core/src/ascii.rs +++ b/library/core/src/ascii.rs @@ -96,6 +96,17 @@ pub fn escape_default(c: u8) -> EscapeDefault { EscapeDefault(escape::EscapeIterInner::new(data, range)) } +impl EscapeDefault { + pub(crate) fn empty() -> Self { + let data = [Char::Null; 4]; + EscapeDefault(escape::EscapeIterInner::new(data, 0..0)) + } + + pub(crate) fn as_str(&self) -> &str { + self.0.as_str() + } +} + #[stable(feature = "rust1", since = "1.0.0")] impl Iterator for EscapeDefault { type Item = u8; |
