rstmt_core/
lib.rs

1//! This crate provides the core functionality for the `rstmt` library, including [`Aspn`],
2//! [`NoteBase`], [`Pitch`], and [`Octave`]. Additionally, the crate provides a host of
3//! other primitives and utilities designed to manifest and manipulate musical concepts.
4//!
5//! ## Overview
6//!
7//! The core modules focus on establishing the basic primitives and interfaces needed to
8//! represent musical notes, pitches, octaves, and related concepts. These modules
9//! provide the foundational building blocks for more complex musical structures and
10//! operations.
11//!
12//! These modules are designed to be efficient, flexible, and correct, ensuring conversions
13//! between different representations are handled seamlessly. For example, _any_ [`PitchClass`]
14//! is able to be converted directly into a [`Frequency`].
15#![crate_name = "rstmt_core"]
16#![crate_type = "lib"]
17#![allow(
18    clippy::derivable_impls,
19    clippy::len_without_is_empty,
20    clippy::missing_errors_doc,
21    clippy::missing_panics_doc,
22    clippy::missing_safety_doc,
23    clippy::module_inception,
24    clippy::needless_doctest_main,
25    clippy::non_canonical_partial_ord_impl,
26    clippy::should_implement_trait,
27    clippy::upper_case_acronyms
28)]
29#![cfg_attr(not(feature = "std"), no_std)]
30#![cfg_attr(all(feature = "alloc", feature = "nightly"), feature(allocator_api))]
31// compiler check
32#[cfg(not(any(feature = "std", feature = "alloc")))]
33compile_error! { "either the \"std\" or \"alloc\" feature must be enabled" }
34// procedural macros
35#[macro_use]
36pub(crate) mod macros {
37    #[macro_use]
38    pub mod seal;
39    #[macro_use]
40    pub mod units;
41}
42
43#[cfg(feature = "alloc")]
44extern crate alloc;
45
46pub mod chords;
47pub mod compose;
48pub mod consts;
49pub mod error;
50pub mod freq;
51pub mod intervals;
52pub mod notes;
53pub mod octave;
54pub mod pitch;
55
56pub mod types {
57    //! this module imimplements various types and other primitives used throughout the library
58    #[doc(inline)]
59    pub use self::harmonic_funcs::*;
60
61    mod harmonic_funcs;
62}
63
64// re-exports
65#[doc(inline)]
66pub use self::{
67    chords::{RawChord, RawChordMut},
68    compose::Scale,
69    consts::*,
70    error::*,
71    freq::{Frequency, RawFrequency},
72    intervals::*,
73    notes::*,
74    octave::*,
75    pitch::*,
76    types::*,
77};
78#[doc(inline)]
79pub use rstmt_traits as traits;
80#[doc(inline)]
81pub use rstmt_traits::prelude::*;
82// prelude
83#[doc(hidden)]
84pub mod prelude {
85    pub use rstmt_traits::prelude::*;
86
87    pub use crate::chords::prelude::*;
88    pub use crate::compose::prelude::*;
89    pub use crate::consts::*;
90    pub use crate::freq::prelude::*;
91    pub use crate::intervals::prelude::*;
92    pub use crate::notes::prelude::*;
93    pub use crate::octave::*;
94    pub use crate::pitch::prelude::*;
95    pub use crate::types::*;
96}