sized 0.2.0

Sized Implementation of Unsized types
Documentation
use sized::SizedBox;

extern crate sized;

#[repr(C)]
#[derive(Default)]
struct Implementation1 {
    _padding: [u8; 16],
}

impl DoesSomething for Implementation1 {
    fn do_the_thing(&mut self) {
        println!("Implementation1")
    }
}

#[repr(C)]
#[derive(Default)]
struct Implementation2 {
    _padding: [u8; 31],
}

impl DoesSomething for Implementation2 {
    fn do_the_thing(&mut self) {
        println!("Implementation2")
    }
}

#[repr(C)]
#[derive(Default)]
struct TooLarge {
    _padding: [u8; 32],
}

impl DoesSomething for TooLarge {
    fn do_the_thing(&mut self) {
        println!("Implementation2")
    }
}

trait DoesSomething {
    fn do_the_thing(&mut self);
}

struct StoreDynType {
    dyn_type: SizedBox<dyn DoesSomething, 31>,
}

fn main() {
    let mut state = StoreDynType {
        dyn_type: SizedBox::new(Implementation1::default()),
    };

    state.dyn_type.do_the_thing();

    state.dyn_type = SizedBox::new(Implementation2::default());

    state.dyn_type.do_the_thing();

    // This should panic at compile time
    //state.dyn_type = SizedBox::new(TooLarge::default());

    //state.dyn_type.do_the_thing();
}