async_cuda/ffi/
mod.rs

1mod includes;
2
3pub mod device;
4pub mod error;
5pub mod memory;
6pub mod ptr;
7pub mod stream;
8
9#[cfg(feature = "npp")]
10pub mod npp;
11
12/// Convenience macro for turning a CUDA error code into a `std::result::Result`.
13///
14/// # Usage
15///
16/// There are two possible uses of the macro:
17///
18/// (1) Shorthand to return `Ok(something)` or a CUDA error:
19///
20/// ```ignore
21/// result!(code, return_value);
22/// ```
23///
24/// (2) Shorthand to return `Ok(())` or a CUDA error:
25///
26/// ```ignore
27/// result!(code)
28/// ```
29macro_rules! result {
30    ($code:expr, $ok:expr) => {
31        if $code == 0 {
32            Ok($ok)
33        } else {
34            Err($crate::error::Error::Cuda($code))
35        }
36    };
37    ($code:expr) => {
38        result!($code, ())
39    };
40}
41
42use result;