simba/
lib.rs

1/*!
2__Simba__ is a crate defining a set of trait for writing code that can be generic with regard to the
3number of lanes of the numeric input value. Those traits are implemented by `f32`, `u32`, `i16`,
4`bool` as well as SIMD types like `f32x4, u32x8, i16x2`, etc.
5
6One example of use-case applied by the [nalgebra crate](https://nalgebra.org) is to define generic methods
7like vector normalization that will work for `Vector3<f32>` as well as `Vector3<f32x4>`.
8
9This makes it easier leverage the power of [SIMD Array-of-Struct-of-Array (AoSoA)](https://www.rustsim.org/blog/2020/03/23/simd-aosoa-in-nalgebra/)
10with less code duplication.
11
12
13## Cargo features
14
15Two cargo features can be optionally enabled:
16- With the __`portable_simd`__ feature enabled, the `simba::simd` module will export several SIMD types like `f32x2`,
17  `f64x4`, `i32i8`, `u16i16`, etc. There types are wrappers around the SIMD types from the experimental [std::simd](https://doc.rust-lang.org/std/simd/index.html)
18  implementation. This requires a nightly compiler and might break after updating the compiler nightly version.
19- With the __`wide`__ feature enabled, the `simba::simd` module will export the `WideF32x4` and `WideBoolF32x4`
20  types. The types are wrappers around the `wide::f32x4` type from the [__wide__ crate](https://docs.rs/wide).
21  This will work with both a stable or nightly compiler.
22
23If none of those features are enabled, __simba__ will still define all the scalar and SIMD traits.
24However, the SIMD traits won't be implemented for any SIMD types. Therefore it is recommended to:
25- Use the `portable_simd` feature if you want more features, and can afford to use a nightly compiler.
26- Use the `wide` feature if you only need 4-lanes 32-bits floats, and can't afford to use a nightly compiler.
27 */
28
29#![deny(non_camel_case_types)]
30#![deny(unused_parens)]
31#![deny(non_upper_case_globals)]
32#![deny(unused_results)]
33#![deny(missing_docs)]
34#![allow(clippy::just_underscores_and_digits)]
35#![allow(clippy::too_many_arguments)]
36#![cfg_attr(not(feature = "std"), no_std)]
37#![cfg_attr(feature = "portable_simd", feature(portable_simd))]
38
39#[cfg(not(feature = "std"))]
40extern crate core as std;
41extern crate num_traits as num;
42
43#[macro_use]
44pub mod scalar;
45pub mod simd;