|
|
@ -158,19 +158,6 @@ impl<T> Vec<T> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub fn into_iter(self) -> IntoIter<T> {
|
|
|
|
|
|
|
|
unsafe {
|
|
|
|
|
|
|
|
let iter = RawValIter::new(&self);
|
|
|
|
|
|
|
|
let buf = ptr::read(&self.buf);
|
|
|
|
|
|
|
|
mem::forget(self);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IntoIter {
|
|
|
|
|
|
|
|
iter: iter,
|
|
|
|
|
|
|
|
_buf: buf,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub fn drain(&mut self) -> Drain<T> {
|
|
|
|
pub fn drain(&mut self) -> Drain<T> {
|
|
|
|
unsafe {
|
|
|
|
unsafe {
|
|
|
|
let iter = RawValIter::new(&self);
|
|
|
|
let iter = RawValIter::new(&self);
|
|
|
@ -208,6 +195,23 @@ impl<T> DerefMut for Vec<T> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
impl<T> IntoIterator for Vec<T> {
|
|
|
|
|
|
|
|
type Item = T;
|
|
|
|
|
|
|
|
type IntoIter = IntoIter<T>;
|
|
|
|
|
|
|
|
fn into_iter(self) -> IntoIter<T> {
|
|
|
|
|
|
|
|
unsafe {
|
|
|
|
|
|
|
|
let iter = RawValIter::new(&self);
|
|
|
|
|
|
|
|
let buf = ptr::read(&self.buf);
|
|
|
|
|
|
|
|
mem::forget(self);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IntoIter {
|
|
|
|
|
|
|
|
iter: iter,
|
|
|
|
|
|
|
|
_buf: buf,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
struct RawValIter<T> {
|
|
|
|
struct RawValIter<T> {
|
|
|
|
start: *const T,
|
|
|
|
start: *const T,
|
|
|
|
end: *const T,
|
|
|
|
end: *const T,
|
|
|
|