pub struct Compiled {
pub grammar: Grammar,
pub registry: FormatRegistry,
pub regexes: RegexCache,
pub schema_document: SokfSchema,
pub schemas: Vec<(SchemaRef, Option<SokfSchema>)>,
pub texts: Texts,
pub problems: Vec<Finding>,
/* private fields */
}Expand description
Compiled holds the grammar and the compiled schemas of one run.
Fields§
§grammar: Grammargrammar holds the grammar that each schema is checked against.
registry: FormatRegistryregistry holds the formats that schemas can use: the embedded
formats, then the layer formats.d, then the repository’s formats, each
layer replacing a format of the same name in the layers under it.
regexes: RegexCacheregexes holds each regular expression that the schemas use, so that
each one is compiled only once.
schema_document: SokfSchemaschema_document is the schema that Schema documents follow, compiled
from the grammar’s schema-document section.
schemas: Vec<(SchemaRef, Option<SokfSchema>)>schemas holds the schema of each Schema document. An entry is None
when the schema doesn’t conform to the grammar, or when the run hasn’t
read the document.
texts: Textstexts holds sokf’s own texts, from which each host takes the words
of a label in the language of a schema, so that a check, a scaffold,
and a guide give a label the same words (SOKF_SCHEMA_107).
problems: Vec<Finding>problems holds the findings that compiling the schemas produced.
Implementations§
Source§impl Compiled
impl Compiled
Sourcepub fn compile_more(&mut self, model: &Model)
pub fn compile_more(&mut self, model: &Model)
compile_more compiles every schema that the model has read since the
last call. Those are the schemas that a check looked up for a
document’s type (CACHE-1_AC-25).
Sourcepub fn schema(&self, r: SchemaRef) -> Option<&SokfSchema>
pub fn schema(&self, r: SchemaRef) -> Option<&SokfSchema>
schema returns the schema of Schema document r, or None when the
schema hasn’t compiled.
Sourcepub fn for_type(
&self,
model: &Model,
knowledge: usize,
type_name: &str,
) -> Option<(SchemaRef, &SokfSchema)>
pub fn for_type( &self, model: &Model, knowledge: usize, type_name: &str, ) -> Option<(SchemaRef, &SokfSchema)>
for_type returns the schema that governs type_name in knowledge,
its own or an inherited one, when exactly one schema declares the type
and that schema compiled. An inherited schema comes as its copy for
knowledge, where it has one. It records that the caller asked for
the type’s schema in each store of the chain that it read
(CACHE-1_AC-25).
Sourcepub fn for_ref(&self, knowledge: usize, r: SchemaRef) -> Option<&SokfSchema>
pub fn for_ref(&self, knowledge: usize, r: SchemaRef) -> Option<&SokfSchema>
for_ref returns the compiled schema r as it governs the documents
of knowledge: its copy for knowledge when knowledge inherits it
and its paths move, and the schema itself otherwise.