Skip to main content

Compiled

Struct Compiled 

Source
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: Grammar

grammar holds the grammar that each schema is checked against.

§registry: FormatRegistry

registry 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: RegexCache

regexes holds each regular expression that the schemas use, so that each one is compiled only once.

§schema_document: SokfSchema

schema_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: Texts

texts 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

Source

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).

Source

pub fn schema(&self, r: SchemaRef) -> Option<&SokfSchema>

schema returns the schema of Schema document r, or None when the schema hasn’t compiled.

Source

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).

Source

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.

Source

pub fn for_doc( &self, model: &Model, knowledge: usize, doc: &Document, ) -> Option<(SchemaRef, &SokfSchema)>

for_doc returns the schema that governs the type of doc in knowledge, as for_type does, or None for a document without a type.

Source

pub fn broken_for_doc( &self, model: &Model, knowledge: usize, doc: &Document, ) -> bool

broken_for_doc returns whether exactly one schema declares the type of doc in knowledge and that schema hasn’t compiled. The check reports such a document under SOKF_VALIDATION_41.

Trait Implementations§

Source§

impl Debug for Compiled

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<'a, T> FromIn<'a, T> for T

Source§

fn from_in(t: T, _: &'a Allocator) -> T

Converts to this type from the input type within the given allocator.
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<'a, T, U> IntoIn<'a, U> for T
where U: FromIn<'a, T>,

Source§

fn into_in(self, allocator: &'a Allocator) -> U

Converts this type into the (usually inferred) input type within the given allocator.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.