From 242066eb7a2833862e65b0447e864038297aa9c3 Mon Sep 17 00:00:00 2001 From: Andrew Hayzen Date: Tue, 3 Oct 2023 15:05:53 +0100 Subject: [PATCH] cxx-qt: export static assertions for cxx-qt-gen This allows for CxxQtSignalHandler to have it's size and align checked by cxx-qt-gen. --- crates/cxx-qt/Cargo.toml | 1 + crates/cxx-qt/src/lib.rs | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/crates/cxx-qt/Cargo.toml b/crates/cxx-qt/Cargo.toml index 84abff57e..463442fa4 100644 --- a/crates/cxx-qt/Cargo.toml +++ b/crates/cxx-qt/Cargo.toml @@ -20,6 +20,7 @@ categories = ["api-bindings", "gui"] [dependencies] cxx.workspace = true cxx-qt-macro.workspace = true +static_assertions = "1.1.0" [dev-dependencies] cxx.workspace = true diff --git a/crates/cxx-qt/src/lib.rs b/crates/cxx-qt/src/lib.rs index 4614de801..72272da03 100644 --- a/crates/cxx-qt/src/lib.rs +++ b/crates/cxx-qt/src/lib.rs @@ -18,6 +18,11 @@ pub use cxx_qt_macro::qobject; pub use cxxqtsignalhandler::{CxxQtSignalHandler, CxxQtSignalHandlerClosure}; pub use cxxqtthread::CxxQtThread; +// Export static assertions that can then be used in cxx-qt-gen generation +// +// These are currently used to ensure that CxxQtSignalHandler has the right size +pub use static_assertions::{assert_eq_align, assert_eq_size}; + /// This trait is automatically implemented for all types which are marked as `#[qobject]`. /// It provides information about the type that is wrapped by the QObject, as well as the methods /// that Cxx-Qt will generate for the QObject.