mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
parent
d6bc438bbc
commit
d7c9bb4b68
@ -1656,6 +1656,8 @@ impl<T:Eq> OwnedEqVector<T> for ~[T] {
|
|||||||
#[allow(missing_doc)]
|
#[allow(missing_doc)]
|
||||||
pub trait MutableVector<'self, T> {
|
pub trait MutableVector<'self, T> {
|
||||||
fn mut_slice(self, start: uint, end: uint) -> &'self mut [T];
|
fn mut_slice(self, start: uint, end: uint) -> &'self mut [T];
|
||||||
|
fn mut_slice_from(self, start: uint) -> &'self mut [T];
|
||||||
|
fn mut_slice_to(self, end: uint) -> &'self mut [T];
|
||||||
fn mut_iter(self) -> VecMutIterator<'self, T>;
|
fn mut_iter(self) -> VecMutIterator<'self, T>;
|
||||||
fn mut_rev_iter(self) -> VecMutRevIterator<'self, T>;
|
fn mut_rev_iter(self) -> VecMutRevIterator<'self, T>;
|
||||||
|
|
||||||
@ -1709,6 +1711,27 @@ impl<'self,T> MutableVector<'self, T> for &'self mut [T] {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a slice of self from `start` to the end of the vec.
|
||||||
|
*
|
||||||
|
* Fails when `start` points outside the bounds of self.
|
||||||
|
*/
|
||||||
|
#[inline]
|
||||||
|
fn mut_slice_from(self, start: uint) -> &'self mut [T] {
|
||||||
|
let len = self.len();
|
||||||
|
self.mut_slice(start, len)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a slice of self from the start of the vec to `end`.
|
||||||
|
*
|
||||||
|
* Fails when `end` points outside the bounds of self.
|
||||||
|
*/
|
||||||
|
#[inline]
|
||||||
|
fn mut_slice_to(self, end: uint) -> &'self mut [T] {
|
||||||
|
self.mut_slice(0, end)
|
||||||
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn mut_split(self, mid: uint) -> (&'self mut [T], &'self mut [T]) {
|
fn mut_split(self, mid: uint) -> (&'self mut [T], &'self mut [T]) {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
Loading…
Reference in New Issue
Block a user