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 __`packed_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 [__packed_simd__
18 crate](https://docs.rs/packed_simd). This requires a nightly compiler.
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 `packed_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)] // FIXME: should be denied
34#![cfg_attr(not(feature = "std"), no_std)]
35
36#[cfg(not(feature = "std"))]
37extern crate core as std;
38extern crate num_traits as num;
39
40#[macro_use]
41pub mod scalar;
42pub mod simd;