diff --git a/library/alloc/src/string.rs b/library/alloc/src/string.rs index 14ffd06e9bd..a164de8b4d3 100644 --- a/library/alloc/src/string.rs +++ b/library/alloc/src/string.rs @@ -2488,6 +2488,13 @@ impl<'a> AsRef for Drain<'a> { } } +#[unstable(feature = "string_drain_as_str", issue = "none")] +impl<'a> AsRef<[u8]> for Drain<'a> { + fn as_ref(&self) -> &[u8] { + self.as_str().as_bytes() + } +} + #[stable(feature = "drain", since = "1.6.0")] impl Iterator for Drain<'_> { type Item = char;