eryon-mem 0.0.4

this crate implements the memory-related aspects of the eryon framework
/*
    Appellation: relationships <module>
    Contrib: @FL03
*/

mod impl_relationship;

/// Represents a relationship between two features
#[derive(Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub struct FeatureRelationship<T = f32> {
    /// Source feature ID
    pub(crate) source_id: usize,
    /// Target feature ID
    pub(crate) to_id: usize,
    /// Type of relationship
    pub(crate) relationship_type: RelationshipType,
    /// Strength/importance of relationship (0.0-1.0)
    pub(crate) strength: T,
    /// Occurrence count
    pub(crate) occurrences: usize,
}

/// Types of relationships between features
#[derive(
    Clone,
    Copy,
    Debug,
    Default,
    Eq,
    Hash,
    Ord,
    PartialEq,
    PartialOrd,
    strum::AsRefStr,
    strum::Display,
    strum::EnumCount,
    strum::EnumIs,
    strum::EnumIter,
    strum::EnumString,
    strum::VariantArray,
    strum::VariantNames,
)]
#[cfg_attr(
    feature = "serde",
    derive(serde::Deserialize, serde::Serialize),
    serde(rename_all = "lowercase")
)]
#[strum(serialize_all = "lowercase")]
pub enum RelationshipType {
    #[default]
    /// One feature typically leads to another
    Causal,
    /// One feature is composed of other features
    Composition,
    Critical,
    Interval,
    /// Features are close in tonal space
    Proximity,
    /// Transformation from one feature to another
    Transformation,
}