use std::{marker::PhantomData, mem::transmute, ops::Deref}; mod object; pub mod operation; mod setting; mod value; mod runtime; mod plugin_initialization; pub use object::*; pub use setting::*; pub use value::*; pub trait ObjectABI { type VTable; } #[repr(transparent)] pub struct VTable { _marker: PhantomData, } impl VTable { /// Creates a new `VTable` reference to a static vtable in memory. /// /// Might be unsafe? It seems like it should be safe... pub const fn new(vtable: &'static V) -> &'static Self { // We're going to transmute the reference to the typed vtable to us // which will probably be fine unsafe { transmute(vtable) } } } impl Deref for VTable { type Target = T::VTable; fn deref(&self) -> &Self::Target { unsafe { transmute(self) } } }