#![cfg_attr(not(test), feature(core_float))]
#![cfg_attr(not(test), feature(exact_size_is_empty))]
#![cfg_attr(not(test), feature(slice_rotate))]
-#![cfg_attr(not(test), feature(str_checked_slicing))]
#![cfg_attr(test, feature(rand, test))]
#![cfg_attr(stage0, feature(allocator))]
#![feature(allow_internal_unstable)]
/// # Examples
///
/// ```
- /// # #![feature(str_checked_slicing)]
/// let v = "🗻∈🌏";
/// assert_eq!(Some("🗻"), v.get(0..4));
/// assert!(v.get(1..).is_none());
/// assert!(v.get(..8).is_none());
/// assert!(v.get(..42).is_none());
/// ```
- #[unstable(feature = "str_checked_slicing", issue = "39932")]
+ #[stable(feature = "str_checked_slicing", since = "1.20.0")]
#[inline]
pub fn get<I: SliceIndex<str>>(&self, i: I) -> Option<&I::Output> {
core_str::StrExt::get(self, i)
/// # Examples
///
/// ```
- /// # #![feature(str_checked_slicing)]
/// let mut v = String::from("🗻∈🌏");
/// assert_eq!(Some("🗻"), v.get_mut(0..4).map(|v| &*v));
/// assert!(v.get_mut(1..).is_none());
/// assert!(v.get_mut(..8).is_none());
/// assert!(v.get_mut(..42).is_none());
/// ```
- #[unstable(feature = "str_checked_slicing", issue = "39932")]
+ #[stable(feature = "str_checked_slicing", since = "1.20.0")]
#[inline]
pub fn get_mut<I: SliceIndex<str>>(&mut self, i: I) -> Option<&mut I::Output> {
core_str::StrExt::get_mut(self, i)
/// # Examples
///
/// ```
- /// # #![feature(str_checked_slicing)]
/// let v = "🗻∈🌏";
/// unsafe {
/// assert_eq!("🗻", v.get_unchecked(0..4));
/// assert_eq!("🌏", v.get_unchecked(7..11));
/// }
/// ```
- #[unstable(feature = "str_checked_slicing", issue = "39932")]
+ #[stable(feature = "str_checked_slicing", since = "1.20.0")]
#[inline]
pub unsafe fn get_unchecked<I: SliceIndex<str>>(&self, i: I) -> &I::Output {
core_str::StrExt::get_unchecked(self, i)
/// # Examples
///
/// ```
- /// # #![feature(str_checked_slicing)]
/// let mut v = String::from("🗻∈🌏");
/// unsafe {
/// assert_eq!("🗻", v.get_unchecked_mut(0..4));
/// assert_eq!("🌏", v.get_unchecked_mut(7..11));
/// }
/// ```
- #[unstable(feature = "str_checked_slicing", issue = "39932")]
+ #[stable(feature = "str_checked_slicing", since = "1.20.0")]
#[inline]
pub unsafe fn get_unchecked_mut<I: SliceIndex<str>>(&mut self, i: I) -> &mut I::Output {
core_str::StrExt::get_unchecked_mut(self, i)
#![feature(repr_align)]
#![feature(slice_rotate)]
#![feature(splice)]
-#![feature(str_checked_slicing)]
#![feature(str_escape)]
#![feature(test)]
#![feature(unboxed_closures)]
}
}
- #[unstable(feature = "str_checked_slicing", issue = "39932")]
+ #[stable(feature = "str_checked_slicing", since = "1.20.0")]
impl SliceIndex<str> for ops::RangeFull {
type Output = str;
#[inline]
}
}
- #[unstable(feature = "str_checked_slicing", issue = "39932")]
+ #[stable(feature = "str_checked_slicing", since = "1.20.0")]
impl SliceIndex<str> for ops::Range<usize> {
type Output = str;
#[inline]
}
}
- #[unstable(feature = "str_checked_slicing", issue = "39932")]
+ #[stable(feature = "str_checked_slicing", since = "1.20.0")]
impl SliceIndex<str> for ops::RangeTo<usize> {
type Output = str;
#[inline]
}
}
- #[unstable(feature = "str_checked_slicing", issue = "39932")]
+ #[stable(feature = "str_checked_slicing", since = "1.20.0")]
impl SliceIndex<str> for ops::RangeFrom<usize> {
type Output = str;
#[inline]
}
}
- #[unstable(feature = "str_checked_slicing", issue = "39932")]
+ #[stable(feature = "str_checked_slicing", since = "1.20.0")]
impl SliceIndex<str> for ops::RangeInclusive<usize> {
type Output = str;
#[inline]
- #[unstable(feature = "str_checked_slicing", issue = "39932")]
+ #[stable(feature = "str_checked_slicing", since = "1.20.0")]
impl SliceIndex<str> for ops::RangeToInclusive<usize> {
type Output = str;
#[inline]
#[rustc_deprecated(since = "1.6.0", reason = "use lines() instead now")]
#[allow(deprecated)]
fn lines_any(&self) -> LinesAny;
- #[unstable(feature = "str_checked_slicing", issue = "39932")]
+ #[stable(feature = "str_checked_slicing", since = "1.20.0")]
fn get<I: SliceIndex<str>>(&self, i: I) -> Option<&I::Output>;
- #[unstable(feature = "str_checked_slicing", issue = "39932")]
+ #[stable(feature = "str_checked_slicing", since = "1.20.0")]
fn get_mut<I: SliceIndex<str>>(&mut self, i: I) -> Option<&mut I::Output>;
- #[unstable(feature = "str_checked_slicing", issue = "39932")]
+ #[stable(feature = "str_checked_slicing", since = "1.20.0")]
unsafe fn get_unchecked<I: SliceIndex<str>>(&self, i: I) -> &I::Output;
- #[unstable(feature = "str_checked_slicing", issue = "39932")]
+ #[stable(feature = "str_checked_slicing", since = "1.20.0")]
unsafe fn get_unchecked_mut<I: SliceIndex<str>>(&mut self, i: I) -> &mut I::Output;
#[stable(feature = "core", since = "1.6.0")]
unsafe fn slice_unchecked(&self, begin: usize, end: usize) -> &str;