Skip to content

Commit

Permalink
Stabilise FromUtf8Error::as_bytes
Browse files Browse the repository at this point in the history
Closes #40895.
  • Loading branch information
varkor committed Mar 17, 2018
1 parent adf2135 commit b57ea56
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/liballoc/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1576,15 +1576,14 @@ impl FromUtf8Error {
/// Basic usage:
///
/// ```
/// #![feature(from_utf8_error_as_bytes)]
/// // some invalid bytes, in a vector
/// let bytes = vec![0, 159];
///
/// let value = String::from_utf8(bytes);
///
/// assert_eq!(&[0, 159], value.unwrap_err().as_bytes());
/// ```
#[unstable(feature = "from_utf8_error_as_bytes", reason = "recently added", issue = "40895")]
#[stable(feature = "from_utf8_error_as_bytes", since = "1.26.0")]
pub fn as_bytes(&self) -> &[u8] {
&self.bytes[..]
}
Expand Down

0 comments on commit b57ea56

Please sign in to comment.