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:
parent
e43c035aed
commit
6018b12670
@ -1,12 +1,12 @@
|
|||||||
use cmake::Config;
|
use cmake::Config;
|
||||||
|
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::path::{Path, PathBuf};
|
|
||||||
use std::fs::canonicalize;
|
use std::fs::canonicalize;
|
||||||
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
pub enum LinkType {
|
pub enum LinkType {
|
||||||
Dynamic,
|
Dynamic,
|
||||||
Static
|
Static,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl LinkType {
|
impl LinkType {
|
||||||
@ -21,14 +21,14 @@ impl LinkType {
|
|||||||
fn link_lib(&self) -> &'static str {
|
fn link_lib(&self) -> &'static str {
|
||||||
match self {
|
match self {
|
||||||
LinkType::Dynamic => "dylib=",
|
LinkType::Dynamic => "dylib=",
|
||||||
LinkType::Static => "static="
|
LinkType::Static => "static=",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn target_name(&self) -> &'static str {
|
fn target_name(&self) -> &'static str {
|
||||||
match self {
|
match self {
|
||||||
LinkType::Dynamic => "aeron_driver",
|
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 out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
|
||||||
|
|
||||||
let link_type = LinkType::detect();
|
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)
|
let lib_dir = Config::new(&aeron_path)
|
||||||
.build_target(link_type.target_name())
|
.build_target(link_type.target_name())
|
||||||
.build();
|
.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());
|
println!("cargo:include={}", header_path.display());
|
||||||
let bindings = bindgen::Builder::default()
|
let bindings = bindgen::Builder::default()
|
||||||
@ -58,4 +65,4 @@ pub fn main() {
|
|||||||
bindings
|
bindings
|
||||||
.write_to_file(out_path.join("bindings.rs"))
|
.write_to_file(out_path.join("bindings.rs"))
|
||||||
.expect("Couldn't write bindings!");
|
.expect("Couldn't write bindings!");
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#![allow(non_upper_case_globals)]
|
#![allow(non_upper_case_globals)]
|
||||||
#![allow(non_camel_case_types)]
|
#![allow(non_camel_case_types)]
|
||||||
#![allow(non_snake_case)]
|
#![allow(non_snake_case)]
|
||||||
|
#![allow(clippy::all)]
|
||||||
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
|
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
15
src/lib.rs
15
src/lib.rs
@ -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) {
|
pub fn aeron_version() -> (u32, u32, u32) {
|
||||||
unsafe {(
|
unsafe {
|
||||||
aeron_driver_sys::aeron_version_major() as u32,
|
(
|
||||||
aeron_driver_sys::aeron_version_minor() as u32,
|
aeron_driver_sys::aeron_version_major() as u32,
|
||||||
aeron_driver_sys::aeron_version_patch() 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