Skip to content

Commit f5bb523

Browse files
committed
Add AsRef<[u8]> for String's Drain.
1 parent 6732840 commit f5bb523

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

library/alloc/src/string.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2488,6 +2488,13 @@ impl<'a> AsRef<str> for Drain<'a> {
24882488
}
24892489
}
24902490

2491+
#[unstable(feature = "string_drain_as_str", issue = "none")]
2492+
impl<'a> AsRef<[u8]> for Drain<'a> {
2493+
fn as_ref(&self) -> &[u8] {
2494+
self.as_str().as_bytes()
2495+
}
2496+
}
2497+
24912498
#[stable(feature = "drain", since = "1.6.0")]
24922499
impl Iterator for Drain<'_> {
24932500
type Item = char;

0 commit comments

Comments
 (0)