diff --git a/build.rs b/build.rs index 1f8343d..58ac97f 100644 --- a/build.rs +++ b/build.rs @@ -1,6 +1,7 @@ +use std::path::PathBuf; + use glob::glob; use rustflags::Flag; -use std::path::PathBuf; pub enum Arch { X64, @@ -111,10 +112,7 @@ fn main() { for flag in rustflags::from_env() { match flag { - Flag::Codegen { - opt, - value: Some(cpu), - } if opt == "target-cpu" => { + Flag::Codegen { opt, value: Some(cpu) } if opt == "target-cpu" => { if cpu == "native" { build.flag("-march=native"); } else { diff --git a/src/lib.rs b/src/lib.rs index 9a774de..8f89c81 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,8 +5,9 @@ clippy::panic, clippy::unwrap_used )] -use ffi::LogLevel; use std::pin::Pin; + +use ffi::LogLevel; use tokio::io::{AsyncRead, AsyncReadExt}; use tokio::runtime::Builder; use tracing::{debug, error, info, info_span, trace, warn, Instrument}; @@ -74,6 +75,9 @@ mod ffi { pub use ffi::{Info, Region}; +unsafe impl Sync for ffi::KakaduContext {} +unsafe impl Send for ffi::KakaduContext {} + pub fn log(level: LogLevel, message: &str) { match level { LogLevel::Debug => debug!(target: "kakadu", message), @@ -91,9 +95,7 @@ pub struct KakaduContext { impl Default for KakaduContext { fn default() -> Self { - Self { - inner: ffi::create_kakadu_context(), - } + Self { inner: ffi::create_kakadu_context() } } } @@ -153,10 +155,7 @@ pub struct AsyncReader { impl AsyncReader { pub fn new(source: R, span: tracing::Span) -> Self { - Self { - stream: Box::pin(source), - span, - } + Self { stream: Box::pin(source), span } } }