1use std::collections::HashMap;
2
3#[derive(Debug, Clone)]
4pub struct Blueprint {
5 pub params: Vec<String>, pub body: String,
7}
8
9#[derive(Debug, Clone)]
10pub struct Fragment {
11 pub params: Vec<String>,
12 pub body: String,
13}
14
15#[derive(Default, Debug)]
17pub struct Registry {
18 pub fragments: HashMap<String, Fragment>,
20 pub blueprints: HashMap<String, Blueprint>,
22 pub schemas: HashMap<String, String>,
24 pub concrete_schemas: HashMap<String, String>,
26}
27
28impl Registry {
29 pub fn new() -> Self {
30 Self::default()
31 }
32
33 pub fn insert_fragment(&mut self, name: String, params: Vec<String>, content: String) {
34 self.fragments.insert(
35 name,
36 Fragment {
37 params,
38 body: content,
39 },
40 );
41 }
42
43 pub fn insert_blueprint(&mut self, name: String, params: Vec<String>, content: String) {
44 self.blueprints.insert(
45 name,
46 Blueprint {
47 params,
48 body: content,
49 },
50 );
51 }
52
53 pub fn insert_schema(&mut self, name: String, content: String) {
54 self.schemas.insert(name, content);
55 }
56}