melodium_loader/
loading_config.rs

1use melodium_common::descriptor::Package;
2use std::path::PathBuf;
3use std::sync::Arc;
4
5/**
6 * Provides base loading configuration.
7 *
8 * The configuration behavior depends on features that are activated on build.
9 * The `search_locations` field is inspected in order.
10 */
11#[derive(Debug, Default)]
12pub struct LoadingConfig {
13    /// List of built-in packages loading procedure can rely on
14    pub core_packages: Vec<Arc<dyn Package>>,
15    /// Locations where loading procedure can look to get packages
16    pub search_locations: Vec<PathBuf>,
17    pub raw_elements: Vec<Arc<Vec<u8>>>,
18}
19
20impl LoadingConfig {
21    pub fn new() -> Self {
22        Self {
23            core_packages: Vec::new(),
24            search_locations: Vec::new(),
25            raw_elements: Vec::new(),
26        }
27    }
28
29    pub fn extend(&mut self, mut other: Self) {
30        self.core_packages.append(&mut other.core_packages);
31        self.search_locations.append(&mut other.search_locations);
32        self.raw_elements.append(&mut other.raw_elements);
33    }
34}