Booleans
The BooleanType
can be used to represent a boolean true
or false
value. Values that
evaluate to true or false, such as 1 and 0, are not accepted by the schema.
#![allow(unused)] fn main() { use schematic::{Schematic, Schema, SchemaBuilder, SchemaType, schema::BooleanType}; impl Schematic for T { fn build_schema(mut schema: SchemaBuilder) -> Schema { schema.boolean_default() } } }
Automatically implemented for
bool
.
Default value
To customize the default value for use within generators, pass the desired
value to the BooleanType
constructor.
#![allow(unused)] fn main() { schema.boolean(BooleanType::new(true)); }