pub struct Schema {
pub tables: Vec<TableDef>,
pub enums: Vec<EnumDef>,
}Expand description
A whole application schema: every #[derive(Table)] struct and
#[derive(DbEnum)] enum found in the tables folder. Tables and enums are
kept sorted by name so snapshots are deterministic regardless of file
ordering.
Fields§
§tables: Vec<TableDef>§enums: Vec<EnumDef>Implementations§
Source§impl Schema
impl Schema
pub fn table(&self, name: &str) -> Option<&TableDef>
Sourcepub fn merge(&mut self, other: Schema, source: &str) -> Result<(), Error>
pub fn merge(&mut self, other: Schema, source: &str) -> Result<(), Error>
Adds another schema’s tables and enums — how a module’s shipped
snapshot joins the app’s schema before diffing. source names the
module for error messages.
§Errors
A table name that already exists, or an enum of the same name with different values, is a hard conflict.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Schema
impl<'de> Deserialize<'de> for Schema
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Schema
Auto Trait Implementations§
impl Freeze for Schema
impl RefUnwindSafe for Schema
impl Send for Schema
impl Sync for Schema
impl Unpin for Schema
impl UnsafeUnpin for Schema
impl UnwindSafe for Schema
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