Skip to content

Commit d4c736b

Browse files
committed
core: Deprecate ImmutableSlice::tailn and initn
These are equivalent to slice_from and slice_to.
1 parent 033f28d commit d4c736b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/libcore/slice.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,12 @@ pub trait ImmutableSlice<'a, T> {
163163
/// Returns all but the first element of a vector
164164
fn tail(&self) -> &'a [T];
165165
/// Returns all but the first `n' elements of a vector
166+
#[deprecated = "use slice_from"]
166167
fn tailn(&self, n: uint) -> &'a [T];
167168
/// Returns all but the last element of a vector
168169
fn init(&self) -> &'a [T];
169170
/// Returns all but the last `n' elements of a vector
171+
#[deprecated = "use slice_to but note the arguments are different"]
170172
fn initn(&self, n: uint) -> &'a [T];
171173
/// Returns the last element of a vector, or `None` if it is empty.
172174
fn last(&self) -> Option<&'a T>;
@@ -339,6 +341,7 @@ impl<'a,T> ImmutableSlice<'a, T> for &'a [T] {
339341
fn tail(&self) -> &'a [T] { self.slice(1, self.len()) }
340342

341343
#[inline]
344+
#[deprecated = "use slice_from"]
342345
fn tailn(&self, n: uint) -> &'a [T] { self.slice(n, self.len()) }
343346

344347
#[inline]
@@ -347,6 +350,7 @@ impl<'a,T> ImmutableSlice<'a, T> for &'a [T] {
347350
}
348351

349352
#[inline]
353+
#[deprecated = "use slice_to but note the arguments are different"]
350354
fn initn(&self, n: uint) -> &'a [T] {
351355
self.slice(0, self.len() - n)
352356
}

0 commit comments

Comments
 (0)