1mod blueprint;
4mod config;
5mod fill;
6mod formats;
7mod ignore;
8mod load;
9mod query;
10mod schema;
11mod schema_yaml;
12mod tree;
13mod types;
14pub(crate) mod validation;
15
16pub use config::{CoercionError, QuillConfig};
17pub use fill::zero_value;
18pub use ignore::QuillIgnore;
19pub use schema::build_transform_schema;
20pub use tree::FileTreeNode;
21pub use types::{
22 field_key, ui_key, BodyCardSchema, CardSchema, FieldSchema, FieldType, UiCardSchema,
23 UiFieldSchema,
24};
25
26use std::collections::HashMap;
27
28use crate::value::QuillValue;
29
30#[derive(Clone)]
36pub struct QuillSource {
37 pub(crate) metadata: HashMap<String, QuillValue>,
38 pub(crate) plate: Option<String>,
39 pub(crate) config: QuillConfig,
40 pub(crate) files: FileTreeNode,
41}
42
43impl QuillSource {
44 pub fn name(&self) -> &str {
46 &self.config.name
47 }
48
49 pub fn backend_id(&self) -> &str {
51 &self.config.backend
52 }
53
54 pub fn metadata(&self) -> &HashMap<String, QuillValue> {
56 &self.metadata
57 }
58
59 pub fn plate(&self) -> Option<&str> {
61 self.plate.as_deref()
62 }
63
64 pub fn config(&self) -> &QuillConfig {
66 &self.config
67 }
68
69 pub fn files(&self) -> &FileTreeNode {
71 &self.files
72 }
73}
74
75impl std::fmt::Debug for QuillSource {
76 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
77 f.debug_struct("QuillSource")
78 .field("name", &self.config.name)
79 .field("backend_id", &self.config.backend)
80 .field(
81 "plate",
82 &self.plate.as_ref().map(|s| format!("<{} bytes>", s.len())),
83 )
84 .field("files", &"<FileTreeNode>")
85 .finish()
86 }
87}
88
89#[cfg(test)]
90mod tests;