pub struct Compiler { /* private fields */ }Expand description
Compile schemas into Rust code.
§Example
// build.rs
fn main() -> Result<(), Box<dyn std::error::Error>> {
thalo_schema::configure()
.add_schema_file("./bank-account.yaml")?
.compile()?;
Ok(())
}Implementations§
Source§impl Compiler
impl Compiler
Sourcepub fn add_schema(self, schema: Aggregate) -> Self
pub fn add_schema(self, schema: Aggregate) -> Self
Adds a schema.
Sourcepub fn add_schema_file<P: AsRef<Path>>(self, path: P) -> Result<Self, Error>
pub fn add_schema_file<P: AsRef<Path>>(self, path: P) -> Result<Self, Error>
Add a schema from a yaml file.
Sourcepub fn add_schema_str(self, content: &str) -> Result<Self, Error>
pub fn add_schema_str(self, content: &str) -> Result<Self, Error>
Add a schema from yaml string.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Compiler
impl RefUnwindSafe for Compiler
impl Send for Compiler
impl Sync for Compiler
impl Unpin for Compiler
impl UnwindSafe for Compiler
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more