randomx_rust_wrapper/
lib.rs1#![warn(rust_2018_idioms)]
18#![warn(rust_2021_compatibility)]
19#![deny(
20 dead_code,
21 nonstandard_style,
22 unused_imports,
23 unused_mut,
24 unused_variables,
25 unused_unsafe,
26 unreachable_patterns
27)]
28
29pub mod bindings;
30pub mod cache;
31pub mod dataset;
32pub mod errors;
33pub mod flags;
34pub mod result_hash;
35#[cfg(test)]
36mod tests;
37pub mod vm;
38
39pub type RResult<T> = Result<T, errors::RandomXError>;
40
41pub use cache::Cache;
42pub use dataset::Dataset;
43pub use errors::RandomXError;
44pub use errors::VmCreationError;
45pub use flags::RandomXFlags;
46pub use result_hash::ResultHash;
47pub use vm::RandomXVM;
48
49macro_rules! try_alloc {
50 ($alloc:expr, $error:expr) => {{
51 let result = unsafe { $alloc };
52 if result.is_null() {
53 return Err($error)?;
54 }
55
56 result
57 }};
58}
59
60pub(crate) use try_alloc;