selene-core 0.9.0-alpha.2

selene-core is the backend for Selene, a local-first music player
Documentation
use crate::library::{
    collectable::Collectable,
    collection::{CollectionItems, DynamicCollectionRules},
};

#[derive(Debug, Clone)]
pub struct CollectionCreateArgs {
    name: String,
    collection_type: CollectionItems,
}

impl CollectionCreateArgs {
    pub fn new(name: impl Into<String>) -> Self {
        Self {
            name: name.into(),
            collection_type: CollectionItems::Static {
                collectables: Vec::new(),
            },
        }
    }

    #[must_use]
    pub fn with_items(mut self, items: Vec<Collectable>) -> Self {
        self.collection_type = CollectionItems::Static {
            collectables: items,
        };
        self
    }

    #[must_use]
    pub fn with_rules(mut self, rules: Vec<DynamicCollectionRules>) -> Self {
        self.collection_type = CollectionItems::Dynamic { rules };
        self
    }
}