use crate::{get_interface, register_interface, ConfClass, ConfObject, Result};
use raw_cstr::AsRawCstr;
pub trait Interface {
type InternalInterface: Default;
type Name: AsRawCstr;
const NAME: Self::Name;
fn new(obj: *mut ConfObject, interface: *mut Self::InternalInterface) -> Self;
fn register(cls: *mut ConfClass) -> Result<()>
where
Self: Sized,
{
register_interface::<Self>(cls)?;
Ok(())
}
fn get(obj: *mut ConfObject) -> Result<Self>
where
Self: Sized,
{
get_interface::<Self>(obj)
}
}
pub trait HasInterface<I>
where
I: Interface,
{
}