Auto merge of #27696 - bluss:into-boxed-str, r=alexcrichton
Rename String::into_boxed_slice -> into_boxed_str This is the name that was decided in rust-lang/rfcs#1152, and it's better if we say “boxed str” for `Box<str>`. The old name `String::into_boxed_slice` is deprecated.
This commit is contained in:
commit
e2bebf32fa
3 changed files with 15 additions and 5 deletions
|
|
@ -729,10 +729,20 @@ impl String {
|
|||
/// Note that this will drop any excess capacity.
|
||||
#[unstable(feature = "box_str",
|
||||
reason = "recently added, matches RFC")]
|
||||
pub fn into_boxed_slice(self) -> Box<str> {
|
||||
pub fn into_boxed_str(self) -> Box<str> {
|
||||
let slice = self.vec.into_boxed_slice();
|
||||
unsafe { mem::transmute::<Box<[u8]>, Box<str>>(slice) }
|
||||
}
|
||||
|
||||
/// Converts the string into `Box<str>`.
|
||||
///
|
||||
/// Note that this will drop any excess capacity.
|
||||
#[unstable(feature = "box_str",
|
||||
reason = "recently added, matches RFC")]
|
||||
#[deprecated(since = "1.4.0", reason = "renamed to `into_boxed_str`")]
|
||||
pub fn into_boxed_slice(self) -> Box<str> {
|
||||
self.into_boxed_str()
|
||||
}
|
||||
}
|
||||
|
||||
impl FromUtf8Error {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue