}
type Link<T> = Option<Box<Node<T>>>;
-struct Rawlink<T> { p: *mut T }
+
+struct Rawlink<T> {
+ p: *mut T,
+}
+
+impl<T> Copy for Rawlink<T> {}
struct Node<T> {
next: Link<T>,
fn clone(&self) -> Items<'a, T> { *self }
}
+impl<'a,T> Copy for Items<'a,T> {}
+
/// An iterator over mutable references to the items of a `DList`.
pub struct MutItems<'a, T:'a> {
list: &'a mut DList<T>,
let mut m = list_from(v.as_slice());
m.prepend(list_from(u.as_slice()));
check_links(&m);
- u.extend(v.as_slice().iter().map(|&b| b));
+ u.extend(v.iter().map(|&b| b));
assert_eq!(u.len(), m.len());
for elt in u.into_iter() {
assert_eq!(m.pop_front(), Some(elt))
spawn(proc() {
check_links(&n);
let a: &[_] = &[&1,&2,&3];
- assert_eq!(a, n.iter().collect::<Vec<&int>>().as_slice());
+ assert_eq!(a, n.iter().collect::<Vec<&int>>());
});
}
#[test]
fn test_show() {
let list: DList<int> = range(0i, 10).collect();
- assert!(list.to_string().as_slice() == "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]");
+ assert!(list.to_string() == "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]");
let list: DList<&str> = vec!["just", "one", "test", "more"].iter()
.map(|&s| s)
.collect();
- assert!(list.to_string().as_slice() == "[just, one, test, more]");
+ assert!(list.to_string() == "[just, one, test, more]");
}
#[cfg(test)]