Skip to main content

mathverse_core/
lib.rs

1#![cfg_attr(not(feature = "std"), no_std)]
2#![forbid(unsafe_code)]
3#![deny(missing_docs)]
4#![warn(clippy::all, clippy::pedantic, clippy::nursery)]
5#![allow(clippy::approx_constant)]
6#![allow(clippy::module_name_repetitions)]
7#![allow(clippy::cast_possible_truncation)]
8#![allow(clippy::cast_sign_loss)]
9#![allow(clippy::cast_precision_loss)]
10#![allow(clippy::missing_errors_doc)]
11#![allow(clippy::missing_panics_doc)]
12#![allow(clippy::return_self_not_must_use)]
13#![allow(clippy::missing_const_for_fn)]
14#![allow(clippy::float_cmp)]
15#![allow(clippy::cast_possible_wrap)]
16#![allow(clippy::unreadable_literal)]
17#![allow(clippy::many_single_char_names)]
18
19
20//! Shared substrate for the `MathVerse` ecosystem.
21//!
22//! Everything here is generic over the [`traits::Num`] hierarchy, works under
23//! `no_std`, and has zero dependencies beyond `core`/`alloc`.
24
25extern crate alloc;
26
27/// Compile-time error: `no_std` builds require the `libm` feature.
28///
29/// `mathverse-core` needs software floating-point math (via `libm`) when
30/// the standard library is not available. Enable the `libm` feature:
31///
32/// ```toml
33/// mathverse-core = { version = "0.1", default-features = false, features = ["libm"] }
34/// ```
35#[cfg(all(not(feature = "std"), not(feature = "libm")))]
36compile_error!(
37    "mathverse-core: either the `std` or `libm` feature must be enabled. \
38     no_std builds require `libm` for transcendental function support."
39);
40
41pub mod algorithms;
42pub mod arrays;
43pub mod constants;
44pub mod error;
45pub mod float;
46pub mod integer;
47pub mod ops;
48pub mod precision;
49pub mod prelude;
50pub mod traits;
51
52/// `libm`-backed transcendental functions for `no_std` builds.
53///
54/// Only available when the `libm` feature is enabled and `std` is disabled.
55#[cfg(all(not(feature = "std"), feature = "libm"))]
56pub mod libm_fallback;