com 0.0.3

Windows COM bindings. (The project is abandoned. Please contact Steve Klabnik if you'd like to take the ownership of it.)
use std::mem;

#[repr(C)]
struct Dummy {
    pub vptr: *const ()
}
 
pub trait Vtable {
    type Vtable;
}

pub unsafe trait HasVtable<T: Vtable> : Sized {
    fn this(&self) -> &T {
        unsafe { mem::transmute(self) }
    }
    
    fn vtable(&self) -> &T::Vtable {
        unsafe {
            let d: &Dummy = mem::transmute(self);
            mem::transmute(d.vptr)
        }
    }
}