Skip to content

Commit

Permalink
Clarify return type of String::from_utf16_lossy.
Browse files Browse the repository at this point in the history
Fixes #32874
  • Loading branch information
frewsxcv committed Sep 14, 2017
1 parent 5dfc84c commit 258ef37
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/liballoc/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,13 @@ impl String {
/// Decode a UTF-16 encoded slice `v` into a `String`, replacing
/// invalid data with the replacement character (U+FFFD).
///
/// Unlike [`from_utf8_lossy`] which returns a [`Cow<'a, str>`],
/// `from_utf16_lossy` returns a `String` since the UTF-16 to UTF-8
/// conversion requires a memory allocation.
///
/// [`from_utf8_lossy`]: #method.from_utf8_lossy
/// [`Cow<'a, str>`]: ../borrow/enum.Cow.html
///
/// # Examples
///
/// Basic usage:
Expand Down

0 comments on commit 258ef37

Please sign in to comment.