From e98bd9bb680c1ac673f4e5e227a57e5adfc7343c Mon Sep 17 00:00:00 2001 From: Luis de Bethencourt Date: Sat, 21 Sep 2013 01:17:22 -0400 Subject: [PATCH] Document a few undocumented methos in Vector Closes #9379 --- src/libstd/vec.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libstd/vec.rs b/src/libstd/vec.rs index 3cdee0eb19a..ae217d6af31 100644 --- a/src/libstd/vec.rs +++ b/src/libstd/vec.rs @@ -925,6 +925,7 @@ impl<'self,T> ImmutableVector<'self, T> for &'self [T] { } #[inline] + /// Returns an iterator over the vector fn iter(self) -> VecIterator<'self, T> { unsafe { let p = vec::raw::to_ptr(self); @@ -941,6 +942,7 @@ impl<'self,T> ImmutableVector<'self, T> for &'self [T] { } #[inline] + /// Returns a reversed iterator over a vector fn rev_iter(self) -> RevIterator<'self, T> { self.iter().invert() } @@ -1931,6 +1933,7 @@ impl<'self,T> MutableVector<'self, T> for &'self mut [T] { } #[inline] + /// Returns an iterator that allows modifying each value fn mut_iter(self) -> VecMutIterator<'self, T> { unsafe { let p = vec::raw::to_mut_ptr(self); @@ -1947,6 +1950,7 @@ impl<'self,T> MutableVector<'self, T> for &'self mut [T] { } #[inline] + /// Returns a reversed iterator that allows modifying each value fn mut_rev_iter(self) -> MutRevIterator<'self, T> { self.mut_iter().invert() } @@ -1988,11 +1992,13 @@ impl<'self,T> MutableVector<'self, T> for &'self mut [T] { } #[inline] + /// Returns an unsafe mutable pointer to the element in index unsafe fn unsafe_mut_ref(self, index: uint) -> *mut T { ptr::mut_offset(self.repr().data as *mut T, index as int) } #[inline] + /// Unsafely sets the element in index to the value unsafe fn unsafe_set(self, index: uint, val: T) { *self.unsafe_mut_ref(index) = val; }