1
This commit is contained in:
parent
687ccf14fa
commit
1a2c64931e
@ -74,11 +74,14 @@ impl<T> ListHead<T> {
|
||||
head.borrow_mut().init();
|
||||
}
|
||||
|
||||
pub fn for_each(&self, cb: fn () -> i64) {
|
||||
let pos = self.next.clone();
|
||||
pub fn for_each(&self, cb: fn (&Weak::<RefCell::<T>>) -> bool) {
|
||||
let mut pos = self.next.clone();
|
||||
let self_weak = &Rc::downgrade(&self.get_rc_refcell());
|
||||
while !Weak::ptr_eq(&pos, self_weak) {
|
||||
|
||||
if !cb(&pos.upgrade().unwrap().borrow().data()) {
|
||||
break;
|
||||
}
|
||||
pos = pos.upgrade().unwrap().borrow().next.clone();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user