1
0
mirror of https://github.com/bspeice/aeron-rs synced 2024-12-21 21:38:09 -05:00

Format, clippy, and start the docs

This commit is contained in:
Bradlee Speice 2019-09-19 23:06:37 -04:00
parent e43c035aed
commit 6018b12670
3 changed files with 25 additions and 13 deletions

View File

@ -1,12 +1,12 @@
use cmake::Config;
use std::env;
use std::path::{Path, PathBuf};
use std::fs::canonicalize;
use std::path::{Path, PathBuf};
pub enum LinkType {
Dynamic,
Static
Static,
}
impl LinkType {
@ -21,14 +21,14 @@ impl LinkType {
fn link_lib(&self) -> &'static str {
match self {
LinkType::Dynamic => "dylib=",
LinkType::Static => "static="
LinkType::Static => "static=",
}
}
fn target_name(&self) -> &'static str {
match self {
LinkType::Dynamic => "aeron_driver",
LinkType::Static => "aeron_driver_static"
LinkType::Static => "aeron_driver_static",
}
}
}
@ -42,11 +42,18 @@ pub fn main() {
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
let link_type = LinkType::detect();
println!("cargo:rustc-link-lib={}{}", link_type.link_lib(), link_type.target_name());
println!(
"cargo:rustc-link-lib={}{}",
link_type.link_lib(),
link_type.target_name()
);
let lib_dir = Config::new(&aeron_path)
.build_target(link_type.target_name())
.build();
println!("cargo:rustc-link-search=native={}", lib_dir.join("build/lib").display());
println!(
"cargo:rustc-link-search=native={}",
lib_dir.join("build/lib").display()
);
println!("cargo:include={}", header_path.display());
let bindings = bindgen::Builder::default()

View File

@ -1,7 +1,7 @@
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(clippy::all)]
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
#[cfg(test)]

View File

@ -1,8 +1,13 @@
//! Aeron client for Rust
#![deny(missing_docs)]
/// Retrieve the C library version in (major, minor, patch) format
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,
)}
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,
)
}
}