joltc_sys/
lib.rs

1mod generated;
2
3pub use generated::*;
4
5#[cfg(feature = "double-precision")]
6pub type Real = f64;
7
8#[cfg(not(feature = "double-precision"))]
9pub type Real = f32;
10
11macro_rules! ffi_default {
12    ($($c_struct:ident -> $default_fn:ident,)*) => {
13        $(
14            impl Default for $c_struct {
15                fn default() -> Self {
16                    unsafe {
17                        let mut settings = std::mem::MaybeUninit::<$c_struct>::zeroed();
18                        $default_fn(settings.as_mut_ptr());
19                        settings.assume_init()
20                    }
21                }
22            }
23        )*
24    };
25}
26
27ffi_default! {
28    JPC_BodyCreationSettings -> JPC_BodyCreationSettings_default,
29
30    // All of the ShapeSettings types
31    JPC_TriangleShapeSettings -> JPC_TriangleShapeSettings_default,
32    JPC_BoxShapeSettings -> JPC_BoxShapeSettings_default,
33    JPC_SphereShapeSettings -> JPC_SphereShapeSettings_default,
34    JPC_CapsuleShapeSettings -> JPC_CapsuleShapeSettings_default,
35    JPC_CylinderShapeSettings -> JPC_CylinderShapeSettings_default,
36    JPC_ConvexHullShapeSettings -> JPC_ConvexHullShapeSettings_default,
37    JPC_SubShapeSettings -> JPC_SubShapeSettings_default,
38    JPC_StaticCompoundShapeSettings -> JPC_StaticCompoundShapeSettings_default,
39    JPC_MutableCompoundShapeSettings -> JPC_MutableCompoundShapeSettings_default,
40}