Fix doc example, and change fn annotation to stable
This commit is contained in:
parent
1a4aa1eb6e
commit
9bfc062723
@ -31,7 +31,7 @@ use iter::FusedIterator;
|
|||||||
/// documentation for more.
|
/// documentation for more.
|
||||||
///
|
///
|
||||||
/// [`escape_default`]: fn.escape_default.html
|
/// [`escape_default`]: fn.escape_default.html
|
||||||
#[unstable(feature = "core_ascii", issue = "46409")]
|
#[stable(feature = "core_ascii", since = "1.26.0")]
|
||||||
pub struct EscapeDefault {
|
pub struct EscapeDefault {
|
||||||
range: Range<usize>,
|
range: Range<usize>,
|
||||||
data: [u8; 4],
|
data: [u8; 4],
|
||||||
@ -57,8 +57,7 @@ pub struct EscapeDefault {
|
|||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// #![no_std]
|
/// use std::ascii;
|
||||||
/// use core::ascii;
|
|
||||||
///
|
///
|
||||||
/// let escaped = ascii::escape_default(b'0').next().unwrap();
|
/// let escaped = ascii::escape_default(b'0').next().unwrap();
|
||||||
/// assert_eq!(b'0', escaped);
|
/// assert_eq!(b'0', escaped);
|
||||||
@ -100,7 +99,7 @@ pub struct EscapeDefault {
|
|||||||
/// assert_eq!(b'9', escaped.next().unwrap());
|
/// assert_eq!(b'9', escaped.next().unwrap());
|
||||||
/// assert_eq!(b'd', escaped.next().unwrap());
|
/// assert_eq!(b'd', escaped.next().unwrap());
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "core_ascii", issue = "46409")]
|
#[stable(feature = "core_ascii", since = "1.26.0")]
|
||||||
pub fn escape_default(c: u8) -> EscapeDefault {
|
pub fn escape_default(c: u8) -> EscapeDefault {
|
||||||
let (data, len) = match c {
|
let (data, len) = match c {
|
||||||
b'\t' => ([b'\\', b't', 0, 0], 2),
|
b'\t' => ([b'\\', b't', 0, 0], 2),
|
||||||
|
Loading…
Reference in New Issue
Block a user