Struct fog_pack::schema::SchemaBuilder
source · 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