std: Fixup some missing stabilization on str
* The `str` module itself is stable. * The `StrExt` trait is stable (and impls). * The `Utf8Error` type is unstable. * The `from_utf8` function is stable * Some iterators are now stable: * `Chars` * `CharIndices` * The `MatchIndices` iterator is now unstable * The public `traits` module is no longer public.
This commit is contained in:
parent
ed22606c83
commit
267b73d95e
2 changed files with 10 additions and 3 deletions
|
|
@ -50,6 +50,7 @@
|
|||
//! is the same as `&[u8]`.
|
||||
|
||||
#![doc(primitive = "str")]
|
||||
#![stable]
|
||||
|
||||
use self::RecompositionState::*;
|
||||
use self::DecompositionType::*;
|
||||
|
|
@ -401,6 +402,7 @@ Section: Trait implementations
|
|||
*/
|
||||
|
||||
/// Any string that can be represented as a slice.
|
||||
#[stable]
|
||||
pub trait StrExt for Sized?: ops::Slice<uint, str> {
|
||||
/// Escapes each char in `s` with `char::escape_default`.
|
||||
#[unstable = "return type may change to be an iterator"]
|
||||
|
|
@ -1340,6 +1342,7 @@ pub trait StrExt for Sized?: ops::Slice<uint, str> {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable]
|
||||
impl StrExt for str {}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
|
|||
|
|
@ -142,6 +142,7 @@ Section: Creating a string
|
|||
|
||||
/// Errors which can occur when attempting to interpret a byte slice as a `str`.
|
||||
#[derive(Copy, Eq, PartialEq, Clone)]
|
||||
#[unstable = "error enumeration recently added and definitions may be refined"]
|
||||
pub enum Utf8Error {
|
||||
/// An invalid byte was detected at the byte offset given.
|
||||
///
|
||||
|
|
@ -165,6 +166,7 @@ pub enum Utf8Error {
|
|||
///
|
||||
/// Returns `Err` if the slice is not utf-8 with a description as to why the
|
||||
/// provided slice is not utf-8.
|
||||
#[stable]
|
||||
pub fn from_utf8(v: &[u8]) -> Result<&str, Utf8Error> {
|
||||
try!(run_utf8_validation_iterator(&mut v.iter()));
|
||||
Ok(unsafe { from_utf8_unchecked(v) })
|
||||
|
|
@ -247,6 +249,7 @@ Section: Iterators
|
|||
///
|
||||
/// Created with the method `.chars()`.
|
||||
#[derive(Clone, Copy)]
|
||||
#[stable]
|
||||
pub struct Chars<'a> {
|
||||
iter: slice::Iter<'a, u8>
|
||||
}
|
||||
|
|
@ -356,6 +359,7 @@ impl<'a> DoubleEndedIterator for Chars<'a> {
|
|||
/// External iterator for a string's characters and their byte offsets.
|
||||
/// Use with the `std::iter` module.
|
||||
#[derive(Clone)]
|
||||
#[stable]
|
||||
pub struct CharIndices<'a> {
|
||||
front_offset: uint,
|
||||
iter: Chars<'a>,
|
||||
|
|
@ -848,6 +852,7 @@ impl Searcher {
|
|||
/// An iterator over the start and end indices of the matches of a
|
||||
/// substring within a larger string
|
||||
#[derive(Clone)]
|
||||
#[unstable = "type may be removed"]
|
||||
pub struct MatchIndices<'a> {
|
||||
// constants
|
||||
haystack: &'a str,
|
||||
|
|
@ -858,7 +863,7 @@ pub struct MatchIndices<'a> {
|
|||
/// An iterator over the substrings of a string separated by a given
|
||||
/// search string
|
||||
#[derive(Clone)]
|
||||
#[unstable = "Type might get removed"]
|
||||
#[unstable = "type may be removed"]
|
||||
pub struct SplitStr<'a> {
|
||||
it: MatchIndices<'a>,
|
||||
last_end: uint,
|
||||
|
|
@ -1056,8 +1061,7 @@ const TAG_CONT_U8: u8 = 0b1000_0000u8;
|
|||
Section: Trait implementations
|
||||
*/
|
||||
|
||||
#[allow(missing_docs)]
|
||||
pub mod traits {
|
||||
mod traits {
|
||||
use cmp::{Ordering, Ord, PartialEq, PartialOrd, Eq};
|
||||
use cmp::Ordering::{Less, Equal, Greater};
|
||||
use iter::IteratorExt;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue