rush_ecs_parser/adapter.rs
1//! Parser Adapter
2//!
3//! Used for parsing Blueprint from the following
4//! supported formats: `TOML`
5
6use anyhow::Result;
7use rush_ecs_core::blueprint::{Blueprint, BlueprintString};
8
9/// Parser Trait
10///
11/// Used as an adapter for different Blueprint file
12/// formats. Enables the flexibility to choose a
13/// different DSL
14///
15// @dev
16// Parser is Send + Sync to enable concurrent parsing
17// Parser is 'static for dynamic dispatch with Box
18pub trait Parser: Send + Sync + 'static {
19 /// Parse [`String`] to [`Blueprint`]
20 fn parse_string(&self, blueprint_string: BlueprintString) -> Result<Blueprint>;
21
22 // TODO: Implement
23 // Parse [`str`] to [`Blueprint`]
24 // fn parse_str(path: &Path) -> Result<Blueprint>;
25}