mod blueprint;
mod compose;
mod config;
mod fill;
mod formats;
mod ignore;
mod load;
mod query;
mod schema;
mod schema_yaml;
mod seed;
mod tree;
mod types;
pub(crate) mod validation;
pub use config::{CoercionError, QuillConfig};
pub use fill::zero_value;
pub use ignore::QuillIgnore;
pub use schema::build_transform_schema;
pub use tree::FileTreeNode;
pub use types::{
field_key, ui_key, BodyCardSchema, CardSchema, FieldSchema, FieldType, UiCardSchema,
UiFieldSchema,
};
use std::collections::HashMap;
use crate::value::QuillValue;
pub const STANDARD_METADATA_KEYS: &[&str] =
&["name", "backend", "description", "version", "author"];
#[derive(Clone)]
pub struct Quill {
pub(crate) metadata: HashMap<String, QuillValue>,
pub(crate) plate: Option<String>,
pub(crate) config: QuillConfig,
pub(crate) files: FileTreeNode,
}
impl Quill {
pub fn name(&self) -> &str {
&self.config.name
}
pub fn backend_id(&self) -> &str {
&self.config.backend
}
pub fn metadata(&self) -> &HashMap<String, QuillValue> {
&self.metadata
}
pub fn plate(&self) -> Option<&str> {
self.plate.as_deref()
}
pub fn config(&self) -> &QuillConfig {
&self.config
}
pub fn files(&self) -> &FileTreeNode {
&self.files
}
pub fn to_tree(&self) -> Vec<(String, Vec<u8>)> {
self.files.flatten()
}
}
impl std::fmt::Debug for Quill {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("Quill")
.field("name", &self.config.name)
.field("backend_id", &self.config.backend)
.field(
"plate",
&self.plate.as_ref().map(|s| format!("<{} bytes>", s.len())),
)
.field("files", &"<FileTreeNode>")
.finish()
}
}
#[cfg(test)]
mod tests;