mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-09 16:37:36 +00:00
parent
e268c7fcc5
commit
e98bd9bb68
@ -925,6 +925,7 @@ impl<'self,T> ImmutableVector<'self, T> for &'self [T] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
/// Returns an iterator over the vector
|
||||||
fn iter(self) -> VecIterator<'self, T> {
|
fn iter(self) -> VecIterator<'self, T> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let p = vec::raw::to_ptr(self);
|
let p = vec::raw::to_ptr(self);
|
||||||
@ -941,6 +942,7 @@ impl<'self,T> ImmutableVector<'self, T> for &'self [T] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
/// Returns a reversed iterator over a vector
|
||||||
fn rev_iter(self) -> RevIterator<'self, T> {
|
fn rev_iter(self) -> RevIterator<'self, T> {
|
||||||
self.iter().invert()
|
self.iter().invert()
|
||||||
}
|
}
|
||||||
@ -1931,6 +1933,7 @@ impl<'self,T> MutableVector<'self, T> for &'self mut [T] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
/// Returns an iterator that allows modifying each value
|
||||||
fn mut_iter(self) -> VecMutIterator<'self, T> {
|
fn mut_iter(self) -> VecMutIterator<'self, T> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let p = vec::raw::to_mut_ptr(self);
|
let p = vec::raw::to_mut_ptr(self);
|
||||||
@ -1947,6 +1950,7 @@ impl<'self,T> MutableVector<'self, T> for &'self mut [T] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
/// Returns a reversed iterator that allows modifying each value
|
||||||
fn mut_rev_iter(self) -> MutRevIterator<'self, T> {
|
fn mut_rev_iter(self) -> MutRevIterator<'self, T> {
|
||||||
self.mut_iter().invert()
|
self.mut_iter().invert()
|
||||||
}
|
}
|
||||||
@ -1988,11 +1992,13 @@ impl<'self,T> MutableVector<'self, T> for &'self mut [T] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
/// Returns an unsafe mutable pointer to the element in index
|
||||||
unsafe fn unsafe_mut_ref(self, index: uint) -> *mut T {
|
unsafe fn unsafe_mut_ref(self, index: uint) -> *mut T {
|
||||||
ptr::mut_offset(self.repr().data as *mut T, index as int)
|
ptr::mut_offset(self.repr().data as *mut T, index as int)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
/// Unsafely sets the element in index to the value
|
||||||
unsafe fn unsafe_set(self, index: uint, val: T) {
|
unsafe fn unsafe_set(self, index: uint, val: T) {
|
||||||
*self.unsafe_mut_ref(index) = val;
|
*self.unsafe_mut_ref(index) = val;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user