use cxx::{type_id, ExternType};
use std::mem::MaybeUninit;
#[cxx::bridge]
mod ffi {
#[namespace = "rust::cxxqt1"]
unsafe extern "C++" {
include!("cxx-qt/connection.h");
#[doc(hidden)]
type QMetaObjectConnection = crate::QMetaObjectConnection;
#[doc(hidden)]
#[rust_name = "qmetaobjectconnection_default"]
fn qmetaobjectconnectionDefault() -> QMetaObjectConnection;
#[doc(hidden)]
#[rust_name = "qmetaobjectconnection_disconnect"]
fn qmetaobjectconnectionDisconnect(connection: &QMetaObjectConnection) -> bool;
#[doc(hidden)]
#[rust_name = "qmetaobjectconnection_drop"]
fn qmetaobjectconnectionDrop(connection: &mut QMetaObjectConnection);
}
#[namespace = "Qt"]
#[repr(i32)]
enum ConnectionType {
AutoConnection,
DirectConnection,
QueuedConnection,
BlockingQueuedConnection,
}
#[namespace = "Qt"]
unsafe extern "C++" {
type ConnectionType;
}
}
#[repr(C)]
pub struct QMetaObjectConnection {
_space: MaybeUninit<usize>,
}
impl Default for QMetaObjectConnection {
fn default() -> Self {
ffi::qmetaobjectconnection_default()
}
}
impl Drop for QMetaObjectConnection {
fn drop(&mut self) {
ffi::qmetaobjectconnection_drop(self);
}
}
impl QMetaObjectConnection {
pub fn disconnect(&self) -> bool {
ffi::qmetaobjectconnection_disconnect(self)
}
}
unsafe impl ExternType for QMetaObjectConnection {
type Id = type_id!("rust::cxxqt1::QMetaObjectConnection");
type Kind = cxx::kind::Trivial;
}
pub use ffi::ConnectionType;