1#![deny(non_camel_case_types)]
11#![deny(unused_parens)]
12#![deny(non_upper_case_globals)]
13#![deny(unused_results)]
14#![deny(unused_qualifications)]
15#![warn(missing_docs)]
16#![warn(unused_imports)]
17#![allow(missing_copy_implementations)]
18#![allow(clippy::too_many_arguments)] #![allow(clippy::module_inception)]
20#![allow(clippy::manual_range_contains)] #![allow(clippy::type_complexity)] #![cfg_attr(feature = "dim2", doc(html_root_url = "https://docs.rs/parry2d"))]
23#![cfg_attr(feature = "dim3", doc(html_root_url = "https://docs.rs/parry3d"))]
24#![no_std]
25
26#[cfg(all(
27 feature = "simd-is-enabled",
28 not(feature = "simd-stable"),
29 not(feature = "simd-nightly")
30))]
31std::compile_error!("The `simd-is-enabled` feature should not be enabled explicitly. Please enable the `simd-stable` or the `simd-nightly` feature instead.");
32#[cfg(all(feature = "simd-is-enabled", feature = "enhanced-determinism"))]
33std::compile_error!(
34 "SIMD cannot be enabled when the `enhanced-determinism` feature is also enabled."
35);
36
37#[cfg(feature = "simd-is-enabled")]
38#[allow(unused_macros)]
39macro_rules! array(
40 ($callback: expr; SIMD_WIDTH) => {
41 {
42 #[inline(always)]
43 #[allow(dead_code)]
44 fn create_arr<T>(mut callback: impl FnMut(usize) -> T) -> [T; SIMD_WIDTH] {
45 #[cfg(not(feature = "simd-is-enabled"))]
46 return [callback(0usize)];
47 #[cfg(feature = "simd-is-enabled")]
48 return [callback(0usize), callback(1usize), callback(2usize), callback(3usize)];
49 }
50
51 create_arr($callback)
52 }
53 }
54);
55
56#[cfg(feature = "std")]
57extern crate std;
58
59#[cfg(feature = "alloc")]
60#[cfg_attr(test, macro_use)]
61extern crate alloc;
62
63#[cfg(feature = "serde")]
64#[macro_use]
65extern crate serde;
66#[macro_use]
67extern crate approx;
68extern crate num_traits as num;
69
70pub extern crate either;
71pub extern crate glamx;
72pub extern crate simba;
73
74#[macro_use]
75mod macros;
76
77pub mod bounding_volume;
78pub mod mass_properties;
79pub mod math;
80pub mod partitioning;
81pub mod query;
82pub mod shape;
83#[cfg(feature = "alloc")]
84pub mod transformation;
85pub mod utils;
86
87#[cfg(not(feature = "simd-is-enabled"))]
88mod simd {
89 pub const SIMD_WIDTH: usize = 1;
91 pub const SIMD_LAST_INDEX: usize = 0;
93
94 #[cfg(feature = "f32")]
96 pub type SimdReal = f32;
97
98 #[cfg(feature = "f64")]
100 pub type SimdReal = f64;
101
102 pub type SimdBool = bool;
104}
105
106#[cfg(feature = "simd-is-enabled")]
107mod simd {
108 #[cfg(all(feature = "simd-nightly", feature = "f32"))]
109 pub use simba::simd::{f32x4 as SimdReal, mask32x4 as SimdBool};
110 #[cfg(all(feature = "simd-stable", feature = "f32"))]
111 pub use simba::simd::{WideBoolF32x4 as SimdBool, WideF32x4 as SimdReal};
112
113 #[cfg(all(feature = "simd-nightly", feature = "f64"))]
114 pub use simba::simd::{f64x4 as SimdReal, mask64x4 as SimdBool};
115 #[cfg(all(feature = "simd-stable", feature = "f64"))]
116 pub use simba::simd::{WideBoolF64x4 as SimdBool, WideF64x4 as SimdReal};
117
118 pub const SIMD_WIDTH: usize = 4;
120 pub const SIMD_LAST_INDEX: usize = 3;
122}