pub struct Schema {
pub declarations: Vec<Declaration>,
pub span: Span,
}Expand description
Top-level schema document containing all declarations.
Fields§
§declarations: Vec<Declaration>All declarations in the schema (datasources, generators, models, enums).
span: SpanSpan covering the entire schema.
Implementations§
Source§impl Schema
impl Schema
Sourcepub fn new(declarations: Vec<Declaration>, span: Span) -> Self
pub fn new(declarations: Vec<Declaration>, span: Span) -> Self
Creates a new schema with the given declarations.
Sourcepub fn models(&self) -> impl Iterator<Item = &ModelDecl>
pub fn models(&self) -> impl Iterator<Item = &ModelDecl>
Finds all model declarations in the schema.
Sourcepub fn enums(&self) -> impl Iterator<Item = &EnumDecl>
pub fn enums(&self) -> impl Iterator<Item = &EnumDecl>
Finds all enum declarations in the schema.
Sourcepub fn types(&self) -> impl Iterator<Item = &TypeDecl>
pub fn types(&self) -> impl Iterator<Item = &TypeDecl>
Finds all composite type declarations in the schema.
Sourcepub fn datasource(&self) -> Option<&DatasourceDecl>
pub fn datasource(&self) -> Option<&DatasourceDecl>
Finds the first datasource declaration.
Sourcepub fn generator(&self) -> Option<&GeneratorDecl>
pub fn generator(&self) -> Option<&GeneratorDecl>
Finds the first generator declaration.
Trait Implementations§
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