mrml_wasm/parser/
memory_include_loader.rs

1use std::collections::HashMap;
2
3#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, tsify::Tsify)]
4#[serde(rename_all = "camelCase")]
5#[tsify(into_wasm_abi, from_wasm_abi)]
6pub struct MemoryIncludeLoaderOptions {
7    pub content: HashMap<String, String>,
8}
9
10impl MemoryIncludeLoaderOptions {
11    pub fn build(
12        self,
13    ) -> Box<dyn mrml::prelude::parser::loader::IncludeLoader + Send + Sync + 'static> {
14        Box::new(mrml::prelude::parser::memory_loader::MemoryIncludeLoader::from(self.content))
15    }
16
17    #[cfg(feature = "async")]
18    pub fn build_async(
19        self,
20    ) -> Box<dyn mrml::prelude::parser::loader::AsyncIncludeLoader + Send + Sync + 'static> {
21        Box::new(mrml::prelude::parser::memory_loader::MemoryIncludeLoader::from(self.content))
22    }
23}