1
Fork 0

Elide lifetimes in libcore

This commit is contained in:
Manish Goregaokar 2015-09-03 15:19:08 +05:30
parent 1661947014
commit a520568ae7
9 changed files with 72 additions and 72 deletions

View file

@ -231,7 +231,7 @@ impl<T:Copy> Cell<T> {
/// ``` /// ```
#[inline] #[inline]
#[unstable(feature = "as_unsafe_cell", issue = "27708")] #[unstable(feature = "as_unsafe_cell", issue = "27708")]
pub unsafe fn as_unsafe_cell<'a>(&'a self) -> &'a UnsafeCell<T> { pub unsafe fn as_unsafe_cell(&self) -> &UnsafeCell<T> {
&self.value &self.value
} }
} }
@ -387,7 +387,7 @@ impl<T: ?Sized> RefCell<T> {
/// ``` /// ```
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[inline] #[inline]
pub fn borrow<'a>(&'a self) -> Ref<'a, T> { pub fn borrow(&self) -> Ref<T> {
match BorrowRef::new(&self.borrow) { match BorrowRef::new(&self.borrow) {
Some(b) => Ref { Some(b) => Ref {
_value: unsafe { &*self.value.get() }, _value: unsafe { &*self.value.get() },
@ -433,7 +433,7 @@ impl<T: ?Sized> RefCell<T> {
/// ``` /// ```
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[inline] #[inline]
pub fn borrow_mut<'a>(&'a self) -> RefMut<'a, T> { pub fn borrow_mut(&self) -> RefMut<T> {
match BorrowRefMut::new(&self.borrow) { match BorrowRefMut::new(&self.borrow) {
Some(b) => RefMut { Some(b) => RefMut {
_value: unsafe { &mut *self.value.get() }, _value: unsafe { &mut *self.value.get() },
@ -450,7 +450,7 @@ impl<T: ?Sized> RefCell<T> {
/// This function is `unsafe` because `UnsafeCell`'s field is public. /// This function is `unsafe` because `UnsafeCell`'s field is public.
#[inline] #[inline]
#[unstable(feature = "as_unsafe_cell", issue = "27708")] #[unstable(feature = "as_unsafe_cell", issue = "27708")]
pub unsafe fn as_unsafe_cell<'a>(&'a self) -> &'a UnsafeCell<T> { pub unsafe fn as_unsafe_cell(&self) -> &UnsafeCell<T> {
&self.value &self.value
} }
} }
@ -541,7 +541,7 @@ impl<'b, T: ?Sized> Deref for Ref<'b, T> {
type Target = T; type Target = T;
#[inline] #[inline]
fn deref<'a>(&'a self) -> &'a T { fn deref(&self) -> &T {
self._value self._value
} }
} }
@ -750,7 +750,7 @@ impl<'b, T: ?Sized> Deref for RefMut<'b, T> {
type Target = T; type Target = T;
#[inline] #[inline]
fn deref<'a>(&'a self) -> &'a T { fn deref(&self) -> &T {
self._value self._value
} }
} }
@ -758,7 +758,7 @@ impl<'b, T: ?Sized> Deref for RefMut<'b, T> {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'b, T: ?Sized> DerefMut for RefMut<'b, T> { impl<'b, T: ?Sized> DerefMut for RefMut<'b, T> {
#[inline] #[inline]
fn deref_mut<'a>(&'a mut self) -> &'a mut T { fn deref_mut(&mut self) -> &mut T {
self._value self._value
} }
} }

View file

@ -51,7 +51,7 @@ impl<T: Zeroable> Deref for NonZero<T> {
type Target = T; type Target = T;
#[inline] #[inline]
fn deref<'a>(&'a self) -> &'a T { fn deref(&self) -> &T {
let NonZero(ref inner) = *self; let NonZero(ref inner) = *self;
inner inner
} }

View file

@ -211,7 +211,7 @@ macro_rules! define_bignum {
self self
} }
pub fn add_small<'a>(&'a mut self, other: $ty) -> &'a mut $name { pub fn add_small(&mut self, other: $ty) -> &mut $name {
use num::flt2dec::bignum::FullOps; use num::flt2dec::bignum::FullOps;
let (mut carry, v) = self.base[0].full_add(other, false); let (mut carry, v) = self.base[0].full_add(other, false);
@ -248,7 +248,7 @@ macro_rules! define_bignum {
/// Multiplies itself by a digit-sized `other` and returns its own /// Multiplies itself by a digit-sized `other` and returns its own
/// mutable reference. /// mutable reference.
pub fn mul_small<'a>(&'a mut self, other: $ty) -> &'a mut $name { pub fn mul_small(&mut self, other: $ty) -> &mut $name {
use num::flt2dec::bignum::FullOps; use num::flt2dec::bignum::FullOps;
let mut sz = self.size; let mut sz = self.size;
@ -267,7 +267,7 @@ macro_rules! define_bignum {
} }
/// Multiplies itself by `2^bits` and returns its own mutable reference. /// Multiplies itself by `2^bits` and returns its own mutable reference.
pub fn mul_pow2<'a>(&'a mut self, bits: usize) -> &'a mut $name { pub fn mul_pow2(&mut self, bits: usize) -> &mut $name {
use mem; use mem;
let digitbits = mem::size_of::<$ty>() * 8; let digitbits = mem::size_of::<$ty>() * 8;
@ -308,7 +308,7 @@ macro_rules! define_bignum {
} }
/// Multiplies itself by `5^e` and returns its own mutable reference. /// Multiplies itself by `5^e` and returns its own mutable reference.
pub fn mul_pow5<'a>(&'a mut self, mut e: usize) -> &'a mut $name { pub fn mul_pow5(&mut self, mut e: usize) -> &mut $name {
use mem; use mem;
use num::flt2dec::bignum::SMALL_POW5; use num::flt2dec::bignum::SMALL_POW5;
@ -377,7 +377,7 @@ macro_rules! define_bignum {
/// Divides itself by a digit-sized `other` and returns its own /// Divides itself by a digit-sized `other` and returns its own
/// mutable reference *and* the remainder. /// mutable reference *and* the remainder.
pub fn div_rem_small<'a>(&'a mut self, other: $ty) -> (&'a mut $name, $ty) { pub fn div_rem_small(&mut self, other: $ty) -> (&mut $name, $ty) {
use num::flt2dec::bignum::FullOps; use num::flt2dec::bignum::FullOps;
assert!(other > 0); assert!(other > 0);

View file

@ -42,7 +42,7 @@ static POW10TO256: [Digit; 27] =
0xcc5573c0, 0x65f9ef17, 0x55bc28f2, 0x80dcc7f7, 0xf46eeddc, 0x5fdcefce, 0x553f7]; 0xcc5573c0, 0x65f9ef17, 0x55bc28f2, 0x80dcc7f7, 0xf46eeddc, 0x5fdcefce, 0x553f7];
#[doc(hidden)] #[doc(hidden)]
pub fn mul_pow10<'a>(x: &'a mut Big, n: usize) -> &'a mut Big { pub fn mul_pow10(x: &mut Big, n: usize) -> &mut Big {
debug_assert!(n < 512); debug_assert!(n < 512);
if n & 7 != 0 { x.mul_small(POW10[n & 7]); } if n & 7 != 0 { x.mul_small(POW10[n & 7]); }
if n & 8 != 0 { x.mul_small(POW10[8]); } if n & 8 != 0 { x.mul_small(POW10[8]); }
@ -54,7 +54,7 @@ pub fn mul_pow10<'a>(x: &'a mut Big, n: usize) -> &'a mut Big {
x x
} }
fn div_2pow10<'a>(x: &'a mut Big, mut n: usize) -> &'a mut Big { fn div_2pow10(x: &mut Big, mut n: usize) -> &mut Big {
let largest = POW10.len() - 1; let largest = POW10.len() - 1;
while n > largest { while n > largest {
x.div_rem_small(POW10[largest]); x.div_rem_small(POW10[largest]);

View file

@ -965,7 +965,7 @@ pub trait Index<Idx: ?Sized> {
/// The method for the indexing (`Foo[Bar]`) operation /// The method for the indexing (`Foo[Bar]`) operation
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn index<'a>(&'a self, index: Idx) -> &'a Self::Output; fn index(&self, index: Idx) -> &Self::Output;
} }
/// The `IndexMut` trait is used to specify the functionality of indexing /// The `IndexMut` trait is used to specify the functionality of indexing
@ -1008,7 +1008,7 @@ pub trait Index<Idx: ?Sized> {
pub trait IndexMut<Idx: ?Sized>: Index<Idx> { pub trait IndexMut<Idx: ?Sized>: Index<Idx> {
/// The method for the indexing (`Foo[Bar]`) operation /// The method for the indexing (`Foo[Bar]`) operation
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn index_mut<'a>(&'a mut self, index: Idx) -> &'a mut Self::Output; fn index_mut(&mut self, index: Idx) -> &mut Self::Output;
} }
/// An unbounded range. /// An unbounded range.
@ -1119,7 +1119,7 @@ pub trait Deref {
/// The method called to dereference a value /// The method called to dereference a value
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn deref<'a>(&'a self) -> &'a Self::Target; fn deref(&self) -> &Self::Target;
} }
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
@ -1180,7 +1180,7 @@ impl<'a, T: ?Sized> Deref for &'a mut T {
pub trait DerefMut: Deref { pub trait DerefMut: Deref {
/// The method called to mutably dereference a value /// The method called to mutably dereference a value
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn deref_mut<'a>(&'a mut self) -> &'a mut Self::Target; fn deref_mut(&mut self) -> &mut Self::Target;
} }
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]

View file

@ -241,7 +241,7 @@ impl<T> Option<T> {
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn as_ref<'r>(&'r self) -> Option<&'r T> { pub fn as_ref(&self) -> Option<&T> {
match *self { match *self {
Some(ref x) => Some(x), Some(ref x) => Some(x),
None => None, None => None,
@ -262,7 +262,7 @@ impl<T> Option<T> {
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn as_mut<'r>(&'r mut self) -> Option<&'r mut T> { pub fn as_mut(&mut self) -> Option<&mut T> {
match *self { match *self {
Some(ref mut x) => Some(x), Some(ref mut x) => Some(x),
None => None, None => None,
@ -289,7 +289,7 @@ impl<T> Option<T> {
#[unstable(feature = "as_slice", #[unstable(feature = "as_slice",
reason = "waiting for mut conventions", reason = "waiting for mut conventions",
issue = "27776")] issue = "27776")]
pub fn as_mut_slice<'r>(&'r mut self) -> &'r mut [T] { pub fn as_mut_slice(&mut self) -> &mut [T] {
match *self { match *self {
Some(ref mut x) => { Some(ref mut x) => {
let result: &mut [T] = slice::mut_ref_slice(x); let result: &mut [T] = slice::mut_ref_slice(x);
@ -692,7 +692,7 @@ impl<T> Option<T> {
#[inline] #[inline]
#[unstable(feature = "as_slice", since = "unsure of the utility here", #[unstable(feature = "as_slice", since = "unsure of the utility here",
issue = "27776")] issue = "27776")]
pub fn as_slice<'a>(&'a self) -> &'a [T] { pub fn as_slice(&self) -> &[T] {
match *self { match *self {
Some(ref x) => slice::ref_slice(x), Some(ref x) => slice::ref_slice(x),
None => { None => {

View file

@ -468,7 +468,7 @@ impl<T:?Sized> Deref for Unique<T> {
type Target = *mut T; type Target = *mut T;
#[inline] #[inline]
fn deref<'a>(&'a self) -> &'a *mut T { fn deref(&self) -> &*mut T {
unsafe { mem::transmute(&*self.pointer) } unsafe { mem::transmute(&*self.pointer) }
} }
} }

View file

@ -69,48 +69,48 @@ use raw::Slice as RawSlice;
pub trait SliceExt { pub trait SliceExt {
type Item; type Item;
fn split_at<'a>(&'a self, mid: usize) -> (&'a [Self::Item], &'a [Self::Item]); fn split_at(&self, mid: usize) -> (&[Self::Item], &[Self::Item]);
fn iter<'a>(&'a self) -> Iter<'a, Self::Item>; fn iter(&self) -> Iter<Self::Item>;
fn split<'a, P>(&'a self, pred: P) -> Split<'a, Self::Item, P> fn split<P>(&self, pred: P) -> Split<Self::Item, P>
where P: FnMut(&Self::Item) -> bool; where P: FnMut(&Self::Item) -> bool;
fn splitn<'a, P>(&'a self, n: usize, pred: P) -> SplitN<'a, Self::Item, P> fn splitn<P>(&self, n: usize, pred: P) -> SplitN<Self::Item, P>
where P: FnMut(&Self::Item) -> bool; where P: FnMut(&Self::Item) -> bool;
fn rsplitn<'a, P>(&'a self, n: usize, pred: P) -> RSplitN<'a, Self::Item, P> fn rsplitn<P>(&self, n: usize, pred: P) -> RSplitN<Self::Item, P>
where P: FnMut(&Self::Item) -> bool; where P: FnMut(&Self::Item) -> bool;
fn windows<'a>(&'a self, size: usize) -> Windows<'a, Self::Item>; fn windows(&self, size: usize) -> Windows<Self::Item>;
fn chunks<'a>(&'a self, size: usize) -> Chunks<'a, Self::Item>; fn chunks(&self, size: usize) -> Chunks<Self::Item>;
fn get<'a>(&'a self, index: usize) -> Option<&'a Self::Item>; fn get(&self, index: usize) -> Option<&Self::Item>;
fn first<'a>(&'a self) -> Option<&'a Self::Item>; fn first(&self) -> Option<&Self::Item>;
fn tail<'a>(&'a self) -> &'a [Self::Item]; fn tail(&self) -> &[Self::Item];
fn init<'a>(&'a self) -> &'a [Self::Item]; fn init(&self) -> &[Self::Item];
fn split_first<'a>(&'a self) -> Option<(&'a Self::Item, &'a [Self::Item])>; fn split_first(&self) -> Option<(&Self::Item, &[Self::Item])>;
fn split_last<'a>(&'a self) -> Option<(&'a Self::Item, &'a [Self::Item])>; fn split_last(&self) -> Option<(&Self::Item, &[Self::Item])>;
fn last<'a>(&'a self) -> Option<&'a Self::Item>; fn last(&self) -> Option<&Self::Item>;
unsafe fn get_unchecked<'a>(&'a self, index: usize) -> &'a Self::Item; unsafe fn get_unchecked(&self, index: usize) -> &Self::Item;
fn as_ptr(&self) -> *const Self::Item; fn as_ptr(&self) -> *const Self::Item;
fn binary_search_by<F>(&self, f: F) -> Result<usize, usize> where fn binary_search_by<F>(&self, f: F) -> Result<usize, usize> where
F: FnMut(&Self::Item) -> Ordering; F: FnMut(&Self::Item) -> Ordering;
fn len(&self) -> usize; fn len(&self) -> usize;
fn is_empty(&self) -> bool { self.len() == 0 } fn is_empty(&self) -> bool { self.len() == 0 }
fn get_mut<'a>(&'a mut self, index: usize) -> Option<&'a mut Self::Item>; fn get_mut(&mut self, index: usize) -> Option<&mut Self::Item>;
fn iter_mut<'a>(&'a mut self) -> IterMut<'a, Self::Item>; fn iter_mut(&mut self) -> IterMut<Self::Item>;
fn first_mut<'a>(&'a mut self) -> Option<&'a mut Self::Item>; fn first_mut(&mut self) -> Option<&mut Self::Item>;
fn tail_mut<'a>(&'a mut self) -> &'a mut [Self::Item]; fn tail_mut(&mut self) -> &mut [Self::Item];
fn init_mut<'a>(&'a mut self) -> &'a mut [Self::Item]; fn init_mut(&mut self) -> &mut [Self::Item];
fn split_first_mut<'a>(&'a mut self) -> Option<(&'a mut Self::Item, &'a mut [Self::Item])>; fn split_first_mut(&mut self) -> Option<(&mut Self::Item, &mut [Self::Item])>;
fn split_last_mut<'a>(&'a mut self) -> Option<(&'a mut Self::Item, &'a mut [Self::Item])>; fn split_last_mut(&mut self) -> Option<(&mut Self::Item, &mut [Self::Item])>;
fn last_mut<'a>(&'a mut self) -> Option<&'a mut Self::Item>; fn last_mut(&mut self) -> Option<&mut Self::Item>;
fn split_mut<'a, P>(&'a mut self, pred: P) -> SplitMut<'a, Self::Item, P> fn split_mut<P>(&mut self, pred: P) -> SplitMut<Self::Item, P>
where P: FnMut(&Self::Item) -> bool; where P: FnMut(&Self::Item) -> bool;
fn splitn_mut<P>(&mut self, n: usize, pred: P) -> SplitNMut<Self::Item, P> fn splitn_mut<P>(&mut self, n: usize, pred: P) -> SplitNMut<Self::Item, P>
where P: FnMut(&Self::Item) -> bool; where P: FnMut(&Self::Item) -> bool;
fn rsplitn_mut<P>(&mut self, n: usize, pred: P) -> RSplitNMut<Self::Item, P> fn rsplitn_mut<P>(&mut self, n: usize, pred: P) -> RSplitNMut<Self::Item, P>
where P: FnMut(&Self::Item) -> bool; where P: FnMut(&Self::Item) -> bool;
fn chunks_mut<'a>(&'a mut self, chunk_size: usize) -> ChunksMut<'a, Self::Item>; fn chunks_mut(&mut self, chunk_size: usize) -> ChunksMut<Self::Item>;
fn swap(&mut self, a: usize, b: usize); fn swap(&mut self, a: usize, b: usize);
fn split_at_mut<'a>(&'a mut self, mid: usize) -> (&'a mut [Self::Item], &'a mut [Self::Item]); fn split_at_mut(&mut self, mid: usize) -> (&mut [Self::Item], &mut [Self::Item]);
fn reverse(&mut self); fn reverse(&mut self);
unsafe fn get_unchecked_mut<'a>(&'a mut self, index: usize) -> &'a mut Self::Item; unsafe fn get_unchecked_mut(&mut self, index: usize) -> &mut Self::Item;
fn as_mut_ptr(&mut self) -> *mut Self::Item; fn as_mut_ptr(&mut self) -> *mut Self::Item;
fn position_elem(&self, t: &Self::Item) -> Option<usize> where Self::Item: PartialEq; fn position_elem(&self, t: &Self::Item) -> Option<usize> where Self::Item: PartialEq;
@ -163,7 +163,7 @@ impl<T> SliceExt for [T] {
} }
#[inline] #[inline]
fn iter<'a>(&'a self) -> Iter<'a, T> { fn iter(&self) -> Iter<T> {
unsafe { unsafe {
let p = if mem::size_of::<T>() == 0 { let p = if mem::size_of::<T>() == 0 {
1 as *const _ 1 as *const _
@ -182,7 +182,7 @@ impl<T> SliceExt for [T] {
} }
#[inline] #[inline]
fn split<'a, P>(&'a self, pred: P) -> Split<'a, T, P> where P: FnMut(&T) -> bool { fn split<P>(&self, pred: P) -> Split<T, P> where P: FnMut(&T) -> bool {
Split { Split {
v: self, v: self,
pred: pred, pred: pred,
@ -191,7 +191,7 @@ impl<T> SliceExt for [T] {
} }
#[inline] #[inline]
fn splitn<'a, P>(&'a self, n: usize, pred: P) -> SplitN<'a, T, P> where fn splitn<P>(&self, n: usize, pred: P) -> SplitN<T, P> where
P: FnMut(&T) -> bool, P: FnMut(&T) -> bool,
{ {
SplitN { SplitN {
@ -204,7 +204,7 @@ impl<T> SliceExt for [T] {
} }
#[inline] #[inline]
fn rsplitn<'a, P>(&'a self, n: usize, pred: P) -> RSplitN<'a, T, P> where fn rsplitn<P>(&self, n: usize, pred: P) -> RSplitN<T, P> where
P: FnMut(&T) -> bool, P: FnMut(&T) -> bool,
{ {
RSplitN { RSplitN {
@ -311,7 +311,7 @@ impl<T> SliceExt for [T] {
} }
#[inline] #[inline]
fn iter_mut<'a>(&'a mut self) -> IterMut<'a, T> { fn iter_mut(&mut self) -> IterMut<T> {
unsafe { unsafe {
let p = if mem::size_of::<T>() == 0 { let p = if mem::size_of::<T>() == 0 {
1 as *mut _ 1 as *mut _
@ -368,12 +368,12 @@ impl<T> SliceExt for [T] {
} }
#[inline] #[inline]
fn split_mut<'a, P>(&'a mut self, pred: P) -> SplitMut<'a, T, P> where P: FnMut(&T) -> bool { fn split_mut<P>(&mut self, pred: P) -> SplitMut<T, P> where P: FnMut(&T) -> bool {
SplitMut { v: self, pred: pred, finished: false } SplitMut { v: self, pred: pred, finished: false }
} }
#[inline] #[inline]
fn splitn_mut<'a, P>(&'a mut self, n: usize, pred: P) -> SplitNMut<'a, T, P> where fn splitn_mut<P>(&mut self, n: usize, pred: P) -> SplitNMut<T, P> where
P: FnMut(&T) -> bool P: FnMut(&T) -> bool
{ {
SplitNMut { SplitNMut {
@ -386,7 +386,7 @@ impl<T> SliceExt for [T] {
} }
#[inline] #[inline]
fn rsplitn_mut<'a, P>(&'a mut self, n: usize, pred: P) -> RSplitNMut<'a, T, P> where fn rsplitn_mut<P>(&mut self, n: usize, pred: P) -> RSplitNMut<T, P> where
P: FnMut(&T) -> bool, P: FnMut(&T) -> bool,
{ {
RSplitNMut { RSplitNMut {
@ -1410,7 +1410,7 @@ impl<'a, T> ExactSizeIterator for ChunksMut<'a, T> {}
/// Converts a pointer to A into a slice of length 1 (without copying). /// Converts a pointer to A into a slice of length 1 (without copying).
#[unstable(feature = "ref_slice", issue = "27774")] #[unstable(feature = "ref_slice", issue = "27774")]
pub fn ref_slice<'a, A>(s: &'a A) -> &'a [A] { pub fn ref_slice<A>(s: &A) -> &[A] {
unsafe { unsafe {
from_raw_parts(s, 1) from_raw_parts(s, 1)
} }
@ -1418,7 +1418,7 @@ pub fn ref_slice<'a, A>(s: &'a A) -> &'a [A] {
/// Converts a pointer to A into a slice of length 1 (without copying). /// Converts a pointer to A into a slice of length 1 (without copying).
#[unstable(feature = "ref_slice", issue = "27774")] #[unstable(feature = "ref_slice", issue = "27774")]
pub fn mut_ref_slice<'a, A>(s: &'a mut A) -> &'a mut [A] { pub fn mut_ref_slice<A>(s: &mut A) -> &mut [A] {
unsafe { unsafe {
from_raw_parts_mut(s, 1) from_raw_parts_mut(s, 1)
} }

View file

@ -142,7 +142,7 @@ pub fn from_utf8(v: &[u8]) -> Result<&str, Utf8Error> {
/// that the string contains valid UTF-8. /// that the string contains valid UTF-8.
#[inline(always)] #[inline(always)]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub unsafe fn from_utf8_unchecked<'a>(v: &'a [u8]) -> &'a str { pub unsafe fn from_utf8_unchecked(v: &[u8]) -> &str {
mem::transmute(v) mem::transmute(v)
} }
@ -1270,9 +1270,9 @@ pub trait StrExt {
fn contains<'a, P: Pattern<'a>>(&'a self, pat: P) -> bool; fn contains<'a, P: Pattern<'a>>(&'a self, pat: P) -> bool;
fn contains_char<'a, P: Pattern<'a>>(&'a self, pat: P) -> bool; fn contains_char<'a, P: Pattern<'a>>(&'a self, pat: P) -> bool;
fn chars<'a>(&'a self) -> Chars<'a>; fn chars(&self) -> Chars;
fn bytes<'a>(&'a self) -> Bytes<'a>; fn bytes(&self) -> Bytes;
fn char_indices<'a>(&'a self) -> CharIndices<'a>; fn char_indices(&self) -> CharIndices;
fn split<'a, P: Pattern<'a>>(&'a self, pat: P) -> Split<'a, P>; fn split<'a, P: Pattern<'a>>(&'a self, pat: P) -> Split<'a, P>;
fn rsplit<'a, P: Pattern<'a>>(&'a self, pat: P) -> RSplit<'a, P> fn rsplit<'a, P: Pattern<'a>>(&'a self, pat: P) -> RSplit<'a, P>
where P::Searcher: ReverseSearcher<'a>; where P::Searcher: ReverseSearcher<'a>;
@ -1288,12 +1288,12 @@ pub trait StrExt {
fn match_indices<'a, P: Pattern<'a>>(&'a self, pat: P) -> MatchIndices<'a, P>; fn match_indices<'a, P: Pattern<'a>>(&'a self, pat: P) -> MatchIndices<'a, P>;
fn rmatch_indices<'a, P: Pattern<'a>>(&'a self, pat: P) -> RMatchIndices<'a, P> fn rmatch_indices<'a, P: Pattern<'a>>(&'a self, pat: P) -> RMatchIndices<'a, P>
where P::Searcher: ReverseSearcher<'a>; where P::Searcher: ReverseSearcher<'a>;
fn lines<'a>(&'a self) -> Lines<'a>; fn lines(&self) -> Lines;
fn lines_any<'a>(&'a self) -> LinesAny<'a>; fn lines_any(&self) -> LinesAny;
fn char_len(&self) -> usize; fn char_len(&self) -> usize;
fn slice_chars<'a>(&'a self, begin: usize, end: usize) -> &'a str; fn slice_chars(&self, begin: usize, end: usize) -> &str;
unsafe fn slice_unchecked<'a>(&'a self, begin: usize, end: usize) -> &'a str; unsafe fn slice_unchecked(&self, begin: usize, end: usize) -> &str;
unsafe fn slice_mut_unchecked<'a>(&'a mut self, begin: usize, end: usize) -> &'a mut str; unsafe fn slice_mut_unchecked(&mut self, begin: usize, end: usize) -> &mut str;
fn starts_with<'a, P: Pattern<'a>>(&'a self, pat: P) -> bool; fn starts_with<'a, P: Pattern<'a>>(&'a self, pat: P) -> bool;
fn ends_with<'a, P: Pattern<'a>>(&'a self, pat: P) -> bool fn ends_with<'a, P: Pattern<'a>>(&'a self, pat: P) -> bool
where P::Searcher: ReverseSearcher<'a>; where P::Searcher: ReverseSearcher<'a>;
@ -1307,14 +1307,14 @@ pub trait StrExt {
fn char_range_at_reverse(&self, start: usize) -> CharRange; fn char_range_at_reverse(&self, start: usize) -> CharRange;
fn char_at(&self, i: usize) -> char; fn char_at(&self, i: usize) -> char;
fn char_at_reverse(&self, i: usize) -> char; fn char_at_reverse(&self, i: usize) -> char;
fn as_bytes<'a>(&'a self) -> &'a [u8]; fn as_bytes(&self) -> &[u8];
fn find<'a, P: Pattern<'a>>(&'a self, pat: P) -> Option<usize>; fn find<'a, P: Pattern<'a>>(&'a self, pat: P) -> Option<usize>;
fn rfind<'a, P: Pattern<'a>>(&'a self, pat: P) -> Option<usize> fn rfind<'a, P: Pattern<'a>>(&'a self, pat: P) -> Option<usize>
where P::Searcher: ReverseSearcher<'a>; where P::Searcher: ReverseSearcher<'a>;
fn find_str<'a, P: Pattern<'a>>(&'a self, pat: P) -> Option<usize>; fn find_str<'a, P: Pattern<'a>>(&'a self, pat: P) -> Option<usize>;
fn split_at(&self, mid: usize) -> (&str, &str); fn split_at(&self, mid: usize) -> (&str, &str);
fn split_at_mut(&mut self, mid: usize) -> (&mut str, &mut str); fn split_at_mut(&mut self, mid: usize) -> (&mut str, &mut str);
fn slice_shift_char<'a>(&'a self) -> Option<(char, &'a str)>; fn slice_shift_char(&self) -> Option<(char, &str)>;
fn subslice_offset(&self, inner: &str) -> usize; fn subslice_offset(&self, inner: &str) -> usize;
fn as_ptr(&self) -> *const u8; fn as_ptr(&self) -> *const u8;
fn len(&self) -> usize; fn len(&self) -> usize;