mirror of
https://github.com/bspeice/aeron-rs
synced 2024-12-21 05:28:10 -05:00
Start on an aeron-rs crate
This commit is contained in:
parent
a1604f49f0
commit
cfad779e03
4
.gitmodules
vendored
4
.gitmodules
vendored
@ -1,3 +1,3 @@
|
||||
[submodule "aeron"]
|
||||
path = aeron
|
||||
[submodule "aeron_driver-sys/aeron"]
|
||||
path = aeron_driver-sys/aeron
|
||||
url = https://github.com/real-logic/aeron
|
||||
|
16
Cargo.toml
16
Cargo.toml
@ -1,16 +1,10 @@
|
||||
[package]
|
||||
name = "libaeron_driver-sys"
|
||||
version = "0.1.0+1.21.2"
|
||||
name = "aeron-rs"
|
||||
version = "0.1.0"
|
||||
authors = ["Bradlee Speice <bradlee@speice.io>"]
|
||||
edition = "2018"
|
||||
links = "aeron_driver"
|
||||
build = "build.rs"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
|
||||
[build-dependencies]
|
||||
bindgen = "0.51"
|
||||
cmake = "0.1"
|
||||
|
||||
[features]
|
||||
static = []
|
||||
aeron_driver-sys = { path = "./aeron_driver-sys" }
|
1
aeron
1
aeron
@ -1 +0,0 @@
|
||||
Subproject commit f3417fd5fb4002d7e3c9c8110f42c6542dee5945
|
1
aeron_driver-sys/.gitignore
vendored
Normal file
1
aeron_driver-sys/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/target
|
16
aeron_driver-sys/Cargo.toml
Normal file
16
aeron_driver-sys/Cargo.toml
Normal file
@ -0,0 +1,16 @@
|
||||
[package]
|
||||
name = "aeron_driver-sys"
|
||||
version = "0.1.0+1.21.2"
|
||||
authors = ["Bradlee Speice <bradlee@speice.io>"]
|
||||
edition = "2018"
|
||||
links = "aeron_driver"
|
||||
build = "build.rs"
|
||||
|
||||
[dependencies]
|
||||
|
||||
[build-dependencies]
|
||||
bindgen = "0.51"
|
||||
cmake = "0.1"
|
||||
|
||||
[features]
|
||||
static = []
|
@ -52,7 +52,6 @@ pub fn main() {
|
||||
let bindings = bindgen::Builder::default()
|
||||
.clang_arg(&format!("-I{}", header_path.display()))
|
||||
.header("bindings.h")
|
||||
.whitelist_function("aeron_version_.*")
|
||||
.generate()
|
||||
.expect("Unable to generate aeron_driver bindings");
|
||||
|
19
aeron_driver-sys/src/lib.rs
Normal file
19
aeron_driver-sys/src/lib.rs
Normal file
@ -0,0 +1,19 @@
|
||||
#![allow(non_upper_case_globals)]
|
||||
#![allow(non_camel_case_types)]
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
#[test]
|
||||
fn version_check() {
|
||||
let major = unsafe { crate::aeron_version_major() };
|
||||
let minor = unsafe { crate::aeron_version_minor() };
|
||||
let patch = unsafe { crate::aeron_version_patch() };
|
||||
assert_eq!(major, 1);
|
||||
assert_eq!(minor, 21);
|
||||
assert_eq!(patch, 2);
|
||||
}
|
||||
}
|
23
src/lib.rs
23
src/lib.rs
@ -1,19 +1,8 @@
|
||||
#![allow(non_upper_case_globals)]
|
||||
#![allow(non_camel_case_types)]
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
#[test]
|
||||
fn version_check() {
|
||||
let major = unsafe { crate::aeron_version_major() };
|
||||
let minor = unsafe { crate::aeron_version_minor() };
|
||||
let patch = unsafe { crate::aeron_version_patch() };
|
||||
assert_eq!(major, 1);
|
||||
assert_eq!(minor, 21);
|
||||
assert_eq!(patch, 2);
|
||||
}
|
||||
pub fn aeron_version() -> (u32, u32, u32) {
|
||||
unsafe {(
|
||||
aeron_driver_sys::aeron_version_major() as u32,
|
||||
aeron_driver_sys::aeron_version_minor() as u32,
|
||||
aeron_driver_sys::aeron_version_patch() as u32,
|
||||
)}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user