-
use std::ptr;
use std::mem;
use std::marker::PhantomData;
if new_last.is_null() {
// The list is now empty.
self.first = new_last;
+ } else {
+ unsafe { (*new_last).next = ptr::null_mut() };
}
let last = unsafe { raw_into_box(last) } ;
Some(last.data)
if new_first.is_null() {
// The list is now empty.
self.last = new_first;
+ } else {
+ unsafe { (*new_first).prev = ptr::null_mut() };
}
let first = unsafe { raw_into_box(first) } ;
Some(first.data)
}
}
- pub fn iter_mut(&self) -> IterMut<T> {
+ pub fn iter_mut(&mut self) -> IterMut<T> {
IterMut { next: self.first, _marker: PhantomData }
}
}