mod config;
mod formats;
mod ignore;
mod load;
mod query;
mod schema;
mod schema_yaml;
mod tree;
mod types;
pub(crate) mod validation;
pub use config::{CoercionError, QuillConfig};
pub use ignore::QuillIgnore;
pub use schema::build_transform_schema;
pub use tree::FileTreeNode;
pub use types::{
field_key, ui_key, CardSchema, FieldSchema, FieldType, UiContainerSchema, UiFieldSchema,
};
use std::collections::HashMap;
use crate::value::QuillValue;
#[derive(Clone)]
pub struct QuillSource {
pub(crate) metadata: HashMap<String, QuillValue>,
pub(crate) name: String,
pub(crate) backend_id: String,
pub(crate) plate: Option<String>,
pub(crate) example: Option<String>,
pub(crate) config: QuillConfig,
pub(crate) files: FileTreeNode,
}
impl QuillSource {
pub fn name(&self) -> &str {
&self.name
}
pub fn backend_id(&self) -> &str {
&self.backend_id
}
pub fn metadata(&self) -> &HashMap<String, QuillValue> {
&self.metadata
}
pub fn plate(&self) -> Option<&str> {
self.plate.as_deref()
}
pub fn example(&self) -> Option<&str> {
self.example.as_deref()
}
pub fn config(&self) -> &QuillConfig {
&self.config
}
pub fn files(&self) -> &FileTreeNode {
&self.files
}
}
impl std::fmt::Debug for QuillSource {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("QuillSource")
.field("name", &self.name)
.field("backend_id", &self.backend_id)
.field(
"plate",
&self.plate.as_ref().map(|s| format!("<{} bytes>", s.len())),
)
.field("example", &self.example.is_some())
.field("files", &"<FileTreeNode>")
.finish()
}
}
#[cfg(test)]
mod tests;