pub struct Schema { /* private fields */ }Expand description
Composes fields and layout blocks and resolves every field once into one list.
Implementations§
Source§impl Schema
impl Schema
Sourcepub fn new(children: impl IntoSchema) -> Self
pub fn new(children: impl IntoSchema) -> Self
Builds a Schema from any IntoSchema and reports duplicate field names as declaration
errors.
pub fn empty() -> Self
Sourcepub fn fields(&self) -> impl Iterator<Item = &Field>
pub fn fields(&self) -> impl Iterator<Item = &Field>
Every field, in the order it joins the schema: a layout’s fields as it composes, in declaration order, and an embedded value’s fields when it binds.
Sourcepub fn bind(self, db: &Db) -> Self
pub fn bind(self, db: &Db) -> Self
Binds the schema’s embedded values and embedded paths to db’s app schema.
A panel binds the schemas it mounts; bind one a custom page renders before rendering it. A schema with no embedded value or path is bound from the start.
Sourcepub async fn render<'a>(
&self,
cx: &'a Cx,
source: Source<'_>,
) -> Result<BoxView<'a>>
pub async fn render<'a>( &self, cx: &'a Cx, source: Source<'_>, ) -> Result<BoxView<'a>>
Renders the schema from source and fails with declaration errors instead of rendering.
§Errors
A misdeclared schema fails with its errors rather than render.
Sourcepub fn declaration_errors(&self) -> Vec<DeclarationErrorKind>
pub fn declaration_errors(&self) -> Vec<DeclarationErrorKind>
Reports what is wrong with this declaration: an embedded value or path never bound, a field whose lens binds no single column, and two fields sharing a name.