learn_rust_bugs 0.1.0

Self-learning Rust
Documentation
use std::ops::Deref;

struct MyBox<T>(T);

impl<T> MyBox<T> {
    fn new(x: T) -> MyBox<T> {
        MyBox(x)
    }
}

impl<T> Deref for MyBox<T> {
    type Target = T;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}

fn mybox_test() {
    let mybox = MyBox::new(1);
    assert_eq!(1, *mybox);
}