Compare commits

..

2 commits

Author SHA1 Message Date
dc4d89a6b3
fix: build.rs add: readmes 2023-04-30 20:47:50 +08:00
3695bba306
advance version 2023-04-30 20:26:31 +08:00
5 changed files with 31 additions and 2 deletions

2
Cargo.lock generated
View file

@ -191,7 +191,7 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
[[package]]
name = "scs-rs-proc-macros"
version = "0.1.0"
version = "0.1.1"
dependencies = [
"quote",
"syn",

4
README.md Normal file
View file

@ -0,0 +1,4 @@
# SCS SDK Bindings for Rust
## How to use
Check out [README.md](scs_rs/README.md) of [scs-sdk-rs](https://crates.io/crates/scs-sdk-rs) crate.

View file

@ -1,6 +1,6 @@
[package]
name = "scs-rs-proc-macros"
version = "0.1.0"
version = "0.1.1"
edition = "2021"
authors = ["LuoRain <luotianyi@luotianyi.me>"]
description = "Procedural macros for scs-rs crate"

22
scs_rs/README.md Normal file
View file

@ -0,0 +1,22 @@
# SCS SDK Bindings
## Usage Example
```rust
#[no_mangle]
#[scs_sdk_rs::proc_macros::scs_telemetry_init]
// pub extern "C" fn scs_telemetry_init(version: scs_sdk_rs::scs_u32_t, params: *const scs_sdk_rs::scs_telemetry_init_params_t) -> scs_sdk_rs::scs_result_t
pub fn init() {
let version_params_ptr = params as *const scs_sdk_rs::scs_telemetry_init_params_v101_t;
unsafe {
// example for using params
let version_params = *version_params_ptr;
version_params.common.log.unwrap()(scs_sdk_rs::SCS_LOG_TYPE_message, "The Rust telemetry plugin is loaded.".as_ptr() as *const i8);
}
// ...
scs_sdk_rs::SCS_RESULT_ok
}
```

View file

@ -5,6 +5,9 @@ fn main() {
let bindings = bindgen::Builder::default()
.header("wrapper.hpp")
.blocklist_item(r#"(\w+)_(MAX|MIN|WIDTH)"#)
.blocklist_item(r#"some_requirement_failed_at_(\d+)"#)
.blocklist_function(r#"(\w+)_(init|shutdown)(\w*)"#)
.parse_callbacks(Box::new(bindgen::CargoCallbacks))
.generate()
.expect("Unable to generate bindings");