1
0
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:
Bradlee Speice 2019-09-19 22:24:35 -04:00
parent a1604f49f0
commit cfad779e03
9 changed files with 49 additions and 32 deletions

4
.gitmodules vendored
View File

@ -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

View File

@ -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 +0,0 @@
Subproject commit f3417fd5fb4002d7e3c9c8110f42c6542dee5945

1
aeron_driver-sys/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/target

View 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 = []

View File

@ -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");

View 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);
}
}

View File

@ -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,
)}
}