cuda_sys/lib.rs
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * LICENSE file in the root directory of this source tree.
7 */
8
9/*
10 * Copyright (c) Meta Platforms, Inc. and affiliates.
11 * All rights reserved.
12 *
13 * This source code is licensed under the BSD-style license found in the
14 * LICENSE file in the root directory of this source tree.
15 */
16
17use cxx::ExternType;
18use cxx::type_id;
19
20/// SAFETY: bindings
21unsafe impl ExternType for CUstream_st {
22 type Id = type_id!("CUstream_st");
23 type Kind = cxx::kind::Opaque;
24}
25
26// When building with cargo, this is actually the lib.rs file for a crate.
27// Include the generated bindings.rs and suppress lints.
28#[allow(non_camel_case_types)]
29#[allow(non_upper_case_globals)]
30#[allow(non_snake_case)]
31mod inner {
32 #[cfg(cargo)]
33 include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
34}
35
36pub use inner::*;
37
38#[cfg(test)]
39mod tests {
40 use std::mem::MaybeUninit;
41
42 use super::*;
43
44 #[test]
45 fn sanity() {
46 // SAFETY: testing bindings
47 unsafe {
48 let mut version = MaybeUninit::<i32>::uninit();
49 let result = cuDriverGetVersion(version.as_mut_ptr());
50 assert_eq!(result, cudaError_enum(0));
51 }
52 }
53}