data-structures 0.1.0

A simple data structures crate in rust, WIP
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use super::node::*;

pub struct IntoIter<T>(pub Next<T>);

impl<T> Iterator for IntoIter<T> {
    type Item = T;

    fn next(&mut self) -> Option<Self::Item> {
        let current_node = std::mem::replace(&mut (*(*self).0), None);

        current_node.map(|node| {
            (*self).0 = node.next;
            node.data
        })
    }
}