rstmt_core/
lib.rs

1/*
2    Appellation: rstmt-core <library>
3    Contrib: @FL03
4*/
5//! # rstmt-core
6//!
7//! This crate provides the core functionality for the `rstmt` library, including [`Aspn`],
8//! [`NoteBase`], [`Pitch`], and [`Octave`]. Additionally, the crate provides a host of
9//! other primitives and utilities designed to manifest and manipulate musical concepts.
10#![allow(
11    clippy::module_inception,
12    clippy::needless_doctest_main,
13    clippy::should_implement_trait
14)]
15#![cfg_attr(not(feature = "std"), no_std)]
16#![cfg_attr(feature = "nightly", feature(allocator_api))]
17#![crate_type = "lib"]
18
19#[cfg(feature = "alloc")]
20extern crate alloc;
21
22#[doc(inline)]
23pub use self::{
24    consts::*,
25    error::*,
26    freq::{Frequency, RawFrequency},
27    notes::{AsAspn, Aspn, IntoAspn, NoteBase},
28    octave::{AsOctave, IntoOctave, Octave},
29    pitch::{AsPitch, IntoPitch, Pitch, PitchClass, RawPitch},
30    traits::prelude::*,
31    types::prelude::*,
32};
33
34#[macro_use]
35pub(crate) mod macros {
36    #[macro_use]
37    pub mod seal;
38}
39
40pub mod error;
41pub mod freq;
42pub mod intervals;
43pub mod notes;
44pub mod octave;
45pub mod pitch;
46
47pub mod consts {
48    //! this module implements various constants used throughout the library.
49    //!
50
51    /// The C Major scale represented as an array of pitch class indices.
52    pub const C_MAJOR_SCALE: [usize; 7] = [0, 2, 4, 5, 7, 9, 11];
53}
54
55pub mod traits {
56    //! this module implements the core traits used throughout the library.
57    #[doc(inline)]
58    pub use self::prelude::*;
59
60    mod chroma;
61    mod num;
62
63    pub(crate) mod prelude {
64        #[doc(inline)]
65        pub use super::chroma::*;
66        #[doc(inline)]
67        pub use super::num::*;
68    }
69}
70
71pub mod types {
72    //! this module imimplements various types and other primitives used throughout the library
73    #[doc(inline)]
74    pub use self::prelude::*;
75
76    mod harmonic_funcs;
77
78    pub(crate) mod prelude {
79        #[doc(inline)]
80        pub use super::harmonic_funcs::*;
81    }
82}
83
84#[doc(hidden)]
85pub mod prelude {
86    pub use crate::consts::*;
87    pub use crate::traits::*;
88    pub use crate::types::*;
89
90    pub use crate::freq::prelude::*;
91    pub use crate::intervals::prelude::*;
92    pub use crate::notes::prelude::*;
93    pub use crate::octave::prelude::*;
94    pub use crate::pitch::prelude::*;
95}