unsafe fn push_at(&mut self, index:i32, value:T){
        let target = self.node_at(index);
        let node = Node::new(value);

        match target {
            Some(mut target) => {
                let prev = target.prev;

                if prev.is_some() {
                    (*prev.unwrap().as_ptr()).next = Some(Box::leak(Box::new(node)).into());

                    let next = (*prev.unwrap().as_ptr()).next;
                    target.prev = next;
                    (*next.unwrap().as_ptr()).next = Some(Box::leak(Box::new(target)).into());
                } else { // target is head
                    target.prev = Some(Box::leak(Box::new(node)).into());

                    let prev = target.prev;

                    (*prev.unwrap().as_ptr()).next = Some(Box::leak(Box::new(target)).into());
                    self.head = prev;
                }
            }
            None => {unimplemented!()}
        }
    }
/// push_at will works like push. which means it will store data in front of nth node, just like push puts data into front.

push_at will works like push. which means it will store data in front of nth node, just like push puts data into front.
push_at will works like push . which means it will store data in front of nth node just like push puts data into front .
unsafe fn push_at(&mut self, index:i32, value:T){
        let target = self.node_at(index);
        let node = Node::new(value);
        match target {
            Some(mut target) => {
                let prev = target.prev;
                if prev.is_some() {
                    (*prev.unwrap().as_ptr()).next = Some(Box::leak(Box::new(node)).into());
                    let next = (*prev.unwrap().as_ptr()).next;
                    target.prev = next;
                    (*next.unwrap().as_ptr()).next = Some(Box::leak(Box::new(target)).into());
                } else { // target is head
                    target.prev = Some(Box::leak(Box::new(node)).into());
                    let prev = target.prev;
                    (*prev.unwrap().as_ptr()).next = Some(Box::leak(Box::new(target)).into());
                    self.head = prev;
                }
            }
            None => {unimplemented!()}
        }
    }
unsafe fn push_at ( & mut self , index : i32 , value : T ) { let target = self . node_at ( index ) ; let node = Node :: new ( value ) ; match target { Some ( mut target ) => { let prev = target . prev ; if prev . is_some ( ) { ( * prev . unwrap ( ) . as_ptr ( ) ) . next = Some ( Box :: leak ( Box :: new ( node ) ) . into ( ) ) ; let next = ( * prev . unwrap ( ) . as_ptr ( ) ) . next ; target . prev = next ; ( * next . unwrap ( ) . as_ptr ( ) ) . next = Some ( Box :: leak ( Box :: new ( target ) ) . into ( ) ) ; } else { // target is head
 target . prev = Some ( Box :: leak ( Box :: new ( node ) ) . into ( ) ) ; let prev = target . prev ; ( * prev . unwrap ( ) . as_ptr ( ) ) . next = Some ( Box :: leak ( Box :: new ( target ) ) . into ( ) ) ; self . head = prev ; } } None => { unimplemented ! ( ) } } }
push_at will works like push.
push_at will works like push .
&mut self
index
i32
value
T
&mut self
index
i32
value
T