yoyu 0.0.1

A compact infrastructure built from scratch.
Documentation

use yoyu::rand::{srand, rand};
use yoyu::list::List;

use std::ptr;

struct Test {
    chain: List,
}

impl Test {
    pub fn new() -> Box<Test> {
        let node = Box::new(Test {
            chain: { List {
                next: ptr::null_mut(),
                prev: ptr::null_mut(),
            } },
        });
        node
    }

    pub fn list (&mut self) -> &mut List {
        &mut self.chain
    }
}

fn main () {
    srand();
    for _ in 0..30 {
        print!("{} ", rand(10));
    }
    println!();
    let mut list = List::new();
    let mut test1 = Test::new();
    let mut test2 = Test::new();

    list.append(test1.list());
    list.append(test2.list());
    println!("list {}", list);
    println!("test1 {}", test1.list());
    println!("test2 {}", test2.list());
    test1.list().delete();
    println!("list {}", list);
    println!("test2 {}", test2.list());
    test2.list().delete();
    println!("list {}", list);
    list.delete();
    println!("list {}", list);
}