Add AsRef<[u8]> for String's Drain.

This commit is contained in:
Mara Bos 2020-09-09 17:59:43 +02:00
parent 673284058b
commit f5bb523e94

View File

@ -2488,6 +2488,13 @@ fn as_ref(&self) -> &str {
}
}
#[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;