]> git.lizzy.rs Git - rust.git/commitdiff
std: Fixup some missing stabilization on str
authorAlex Crichton <alex@alexcrichton.com>
Mon, 5 Jan 2015 07:32:20 +0000 (23:32 -0800)
committerAlex Crichton <alex@alexcrichton.com>
Mon, 5 Jan 2015 07:32:20 +0000 (23:32 -0800)
* 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.

src/libcollections/str.rs
src/libcore/str/mod.rs

index ed6a957d2acfacbbecfe4de8238e9c85e92f25e3..fee06422fdd1f389f3cf8b302a44749486c4ca47 100644 (file)
@@ -50,6 +50,7 @@
 //! is the same as `&[u8]`.
 
 #![doc(primitive = "str")]
+#![stable]
 
 use self::RecompositionState::*;
 use self::DecompositionType::*;
@@ -401,6 +402,7 @@ fn to_owned(&self) -> String {
 */
 
 /// 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 @@ fn trim_right(&self) -> &str {
     }
 }
 
+#[stable]
 impl StrExt for str {}
 
 #[cfg(test)]
index d069744f8da54f109bba4c957240999bbbfa8258..964e0089e44eed31727ea35310b5349a34cc96da 100644 (file)
@@ -142,6 +142,7 @@ fn from_str(s: &str) -> Option<bool> {
 
 /// 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 @@ fn only_ascii(&self) -> bool {
 ///
 /// Created with the method `.chars()`.
 #[derive(Clone, Copy)]
+#[stable]
 pub struct Chars<'a> {
     iter: slice::Iter<'a, u8>
 }
@@ -356,6 +359,7 @@ fn next_back(&mut self) -> Option<char> {
 /// 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 @@ fn new(haystack: &[u8], needle: &[u8]) -> 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 @@ pub struct CharRange {
 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;