Trying out qmetaobject-rs method for docs.
This commit is contained in:
parent
ce6adf77ca
commit
b8f1cbaed7
|
@ -2,7 +2,7 @@
|
|||
name = "ki18n-rs"
|
||||
description = "A crate to use KF5I18n from rust."
|
||||
author = ["Ayush Singh <ayushdevel1325@gmail.com>"]
|
||||
version = "1.0.2"
|
||||
version = "0.1.2"
|
||||
edition = "2018"
|
||||
links = "KF5I18n"
|
||||
license = "MIT"
|
||||
|
@ -17,7 +17,7 @@ qmetaobject = "0.2"
|
|||
qttypes = "0.2"
|
||||
|
||||
[build-dependencies]
|
||||
cpp_build = {version = "0.5 ", features = ["docs-only"]}
|
||||
cpp_build = "0.5"
|
||||
semver = "1.0"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
|
|
21
src/lib.rs
21
src/lib.rs
|
@ -39,10 +39,29 @@
|
|||
//! engine.exec();
|
||||
//! }
|
||||
//! ```
|
||||
use qmetaobject::prelude::*;
|
||||
use std::ffi::c_void;
|
||||
|
||||
#[cfg(not(no_qt))]
|
||||
use cpp::{cpp, cpp_class};
|
||||
use qmetaobject::prelude::*;
|
||||
|
||||
#[cfg(no_qt)]
|
||||
mod no_qt {
|
||||
pub fn panic<T>() -> T {
|
||||
panic!("This example is not supported on Qt 6 and above")
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(no_qt)]
|
||||
macro_rules! cpp {
|
||||
{{ $($t:tt)* }} => {};
|
||||
{$(unsafe)? [$($a:tt)*] -> $ret:ty as $b:tt { $($t:tt)* } } => {
|
||||
crate::no_qt::panic::<$ret>()
|
||||
};
|
||||
{ $($t:tt)* } => {
|
||||
crate::no_qt::panic::<()>()
|
||||
};
|
||||
}
|
||||
|
||||
cpp! {{
|
||||
#include <KLocalizedContext>
|
||||
|
|
Loading…
Reference in a new issue