1
This commit is contained in:
parent
afb739327f
commit
2f86bbc0ae
@ -14,7 +14,7 @@ pub struct ListHead<T> {
|
||||
|
||||
impl<T> ListHead<T> {
|
||||
|
||||
pub fn new_head() -> Rc::<RefCell::<ListHead<T>>> {
|
||||
pub fn new_head() -> Rc::<RefCell::<Self>> {
|
||||
let this = Rc::new(RefCell::new(ListHead{
|
||||
prev: Default::default(),
|
||||
next: Default::default(),
|
||||
@ -26,13 +26,14 @@ impl<T> ListHead<T> {
|
||||
return this;
|
||||
}
|
||||
|
||||
pub fn new_node(data: Weak::<RefCell::<T>>) -> Rc::<RefCell::<ListHead<T>>> {
|
||||
pub fn new_node(data: Weak::<RefCell::<T>>) -> Rc::<RefCell::<Self>> {
|
||||
let this = Rc::new(RefCell::new(ListHead{
|
||||
prev: Weak::<RefCell::<ListHead<T>>>::new(),
|
||||
next: Weak::<RefCell::<ListHead<T>>>::new(),
|
||||
prev: Default::default(),
|
||||
next: Default::default(),
|
||||
data: data,
|
||||
_self_wp: Weak::<RefCell::<ListHead<T>>>::new()
|
||||
_self_wp: Default::default(),
|
||||
}));
|
||||
this.borrow_mut()._self_wp = Rc::downgrade(&this);
|
||||
this.borrow_mut().init();
|
||||
return this;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user