/** Delete the index-th node in the linked list, if the index is valid. */
Delete the index-th node in the linked list, if the index is valid.
Delete the index - th node in the linked list if the index is valid .
pub fn delete_at_index(&self, index: i32) {
        if index >= self.len.get() || index < 0 {
            return;
        }
        let p = self.locate(index).borrow().next.clone().unwrap();
        let prev = p.borrow().prev.as_ref().unwrap().upgrade().clone().unwrap();
        let next = p.borrow().next.clone().unwrap();
        prev.borrow_mut().next = Some(next.clone());
        next.borrow_mut().prev = Some(Rc::downgrade(&prev));
        self.len.set(self.len.get() - 1);
    }
pub fn delete_at_index ( & self , index : i32 ) { if index >= self . len . get ( ) || index < 0 { return ; } let p = self . locate ( index ) . borrow ( ) . next . clone ( ) . unwrap ( ) ; let prev = p . borrow ( ) . prev . as_ref ( ) . unwrap ( ) . upgrade ( ) . clone ( ) . unwrap ( ) ; let next = p . borrow ( ) . next . clone ( ) . unwrap ( ) ; prev . borrow_mut ( ) . next = Some ( next . clone ( ) ) ; next . borrow_mut ( ) . prev = Some ( Rc :: downgrade ( & prev ) ) ; self . len . set ( self . len . get ( ) - 1 ) ; }
Delete the index-th node in the linked list, if the index is valid.
Delete the index - th node in the linked list if the index is valid .
&self
index
i32