use cxx::ExternType;
#[doc(hidden)]
pub trait CxxQtSignalHandlerClosure {
type Id;
type FnType: ?Sized;
}
#[doc(hidden)]
#[repr(transparent)]
pub struct CxxQtSignalHandler<T>
where
T: CxxQtSignalHandlerClosure,
{
closure: Box<T::FnType>,
}
impl<T> CxxQtSignalHandler<T>
where
T: CxxQtSignalHandlerClosure,
{
pub fn new(closure: Box<T::FnType>) -> Self {
Self { closure }
}
pub fn closure(&mut self) -> &mut Box<T::FnType> {
&mut self.closure
}
}
unsafe impl<T> ExternType for CxxQtSignalHandler<T>
where
T: CxxQtSignalHandlerClosure,
{
type Kind = cxx::kind::Trivial;
type Id = T::Id;
}