pub struct SchemaBuilder { /* private fields */ }Expand description
Builds schemas up from Validators.
A schema can be directly made from any document, but it’s generally much easier to construct
them from Validator structs and turn the result into a
Document.
Implementations§
Source§impl SchemaBuilder
impl SchemaBuilder
Sourcepub fn new(doc: Validator) -> Self
pub fn new(doc: Validator) -> Self
Start building a new schema. Requires the validator to use for any documents adhering to this schema.
Sourcepub fn description(self, description: &str) -> Self
pub fn description(self, description: &str) -> Self
Set the schema description. This is only used for documentation purposes.
Sourcepub fn doc_compress(self, doc_compress: Compress) -> Self
pub fn doc_compress(self, doc_compress: Compress) -> Self
Set the default compression to use for documents adhering to this schema.
Sourcepub fn entry_add(
self,
entry: &str,
validator: Validator,
compress: Option<Compress>,
) -> Self
pub fn entry_add( self, entry: &str, validator: Validator, compress: Option<Compress>, ) -> Self
Add a new entry type to the schema, where entry is the key for the entry, validator
will be used to validate each entry, and compress optionally overrides the default
compression with a specific compression setting.
Sourcepub fn name(self, name: &str) -> Self
pub fn name(self, name: &str) -> Self
Set the schema name. This is only used for documentation purposes.
Sourcepub fn type_add(self, type_ref: &str, validator: Validator) -> Self
pub fn type_add(self, type_ref: &str, validator: Validator) -> Self
Add a new stored type to the schema.
Sourcepub fn type_get(&self, type_ref: &str) -> Option<&Validator>
pub fn type_get(&self, type_ref: &str) -> Option<&Validator>
Look up a type that has already been stored.
Sourcepub fn version<T: Into<Integer>>(self, version: T) -> Self
pub fn version<T: Into<Integer>>(self, version: T) -> Self
Set the schema version. This is only used for documentation purposes.
Trait Implementations§
Source§impl Clone for SchemaBuilder
impl Clone for SchemaBuilder
Source§fn clone(&self) -> SchemaBuilder
fn clone(&self) -> SchemaBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more