Skip to content

Commit e73eea9

Browse files
committed
Add impl AsMut<[u8]> for Box<str>
1 parent d9b73e1 commit e73eea9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

library/alloc/src/boxed.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2057,6 +2057,13 @@ impl<T: ?Sized, A: Allocator> AsMut<T> for Box<T, A> {
20572057
}
20582058
}
20592059

2060+
#[stable(feature = "smart_ptr_as_ref_str", since = "CURRENT_RUSTC_VERSION")]
2061+
impl<A: Allocator> AsMut<[u8]> for Box<str, A> {
2062+
fn as_ref(&self) -> &[u8] {
2063+
(&mut **self).as_ref()
2064+
}
2065+
}
2066+
20602067
/* Nota bene
20612068
*
20622069
* We could have chosen not to add this impl, and instead have written a

0 commit comments

Comments
 (0)