rstmt-nrt 0.1.0

this crate focuses on providing support for the neo-riemannian theory of music
Documentation
/*
    Appellation: rstmt-nrt <library>
    Contrib: @FL03
*/
//! This crate works to establish a solid foundation fo exploring the neo-riemannian theory,
//! providing implementations of the [`Triad`], its transformations [`LPR`], and the
//! generalized tonnetz ([`HyperTonnetz`]).
//!
//! ## Background
//!
//! The neo-riemannian theory is a loose collection of musical theories focused on the triad.
//! Research in the field has been ongoing for over a century, culminating in the successful
//! generalization of the tonnetz, a geometric representation of the triad and its
//! transformations, into a single topological entity composed of individual simplices.
//!
//! ## Examples
//!
//! ### _Basic Usage_
//!
//! Create a C major triad and perform some basic operations.
//!
//! ```rust
//! use rstmt_nrt::Triad;
//! // initialize a c-major triad: (0, 4, 7)
//! let triad = Triad::major(0);
//! // verify the composition
//! assert_eq! { triad.is_major(), triad == [0, 4, 7] }
//! // apply a single, parallel transformation and verify
//! assert_eq! { triad.parallel(), [0, 3, 7] }
//! // chain together two parallel transformations to confirm inversion
//! assert_eq! { triad.parallel().parallel(), triad }
//! ```
#![allow(
    clippy::derivable_impls,
    clippy::len_without_is_empty,
    clippy::missing_errors_doc,
    clippy::missing_panics_doc,
    clippy::missing_safety_doc,
    clippy::module_inception,
    clippy::needless_doctest_main,
    clippy::non_canonical_partial_ord_impl,
    clippy::should_implement_trait,
    clippy::upper_case_acronyms
)]
#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(all(feature = "alloc", feature = "nightly"), feature(allocator_api))]
// compiler check
#[cfg(not(any(feature = "std", feature = "alloc")))]
compile_error! { "either the \"std\" or \"alloc\" feature must be enabled" }
// external crates
#[cfg(feature = "alloc")]
extern crate alloc;
/// re-declare the external `rstmt_core` crate as `rstmt` for convenience
extern crate rstmt_core as rstmt;

#[macro_use]
pub(crate) mod macros {
    #[macro_use]
    pub mod seal;
}
/// this module defines the standard error type, [`TriadError`], for the crate
pub mod error;
#[cfg(feature = "motion")]
pub mod motion;
#[cfg(feature = "tonnetz")]
pub mod tonnetz;
pub mod triad;

mod impls {
    mod impl_triad_base;
    mod impl_triad_ext;
    mod impl_triad_repr;
}

pub mod iter {
    //! this module defines various iterators for traversing a tonnetz, chaining
    //! transformations and more.

    #[cfg(feature = "rayon")]
    #[doc(inline)]
    pub use self::parallel::ParIter;
    #[doc(inline)]
    pub use self::walker::Walk;

    #[cfg(feature = "rayon")]
    pub mod parallel;
    pub mod walker;

    pub(crate) mod prelude {
        #[cfg(feature = "rayon")]
        pub use super::parallel::*;
        pub use super::walker::*;
    }
}

mod traits {
    #[doc(inline)]
    pub use self::{raw_triad::*, triad_type::*};

    mod raw_triad;
    mod triad_type;
}

mod types {
    #[doc(inline)]
    pub use self::{factors::*, kinds::*, lpr::*};

    mod factors;
    mod kinds;
    mod lpr;
}
// re-exports
#[doc(inline)]
#[cfg(feature = "tonnetz")]
pub use self::tonnetz::HyperTonnetz;
#[doc(inline)]
pub use self::{error::*, iter::prelude::*, traits::*, triad::*, types::*};
// prelude
#[doc(hidden)]
pub mod prelude {
    pub use crate::iter::prelude::*;
    #[cfg(feature = "motion")]
    pub use crate::motion::prelude::*;
    #[cfg(feature = "tonnetz")]
    pub use crate::tonnetz::*;
    pub use crate::traits::*;
    pub use crate::triad::*;
    pub use crate::types::*;
}