yoyu 0.0.2

A compact infrastructure built from scratch.
Documentation

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

struct Vec3 {
    x: i32,
    y: i32,
    z: i32,
}

struct Test {
    chain: List,
}

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

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

fn main () {
    
    let mut v = Cell::new(Vec3 { x: 1, y: 2, z: 3 });
    println!("Vec3: ({}, {}, {})", v.x, v.y, v.z);
    v.z += 1;
    println!("Vec3: ({}, {}, {})", v.x, v.y, v.z);

    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().next().prev());
    test2.list().delete();
    println!("list {}", list);
//    list.delete();
//    println!("list {}", list);
}