Struct jtd_derive::gen::Generator
source · #[non_exhaustive]pub struct Generator {}Expand description
A configurable schema generator. An instance is meant to produce one
RootSchema and be consumed in the process.
For now, the generator is not configurable and the only way to
construct one is by calling Generator::default().
Implementations§
source§impl Generator
impl Generator
sourcepub fn into_root_schema<T: JsonTypedef>(self) -> RootSchema
pub fn into_root_schema<T: JsonTypedef>(self) -> RootSchema
Generate the root schema for the given type according to the settings. This consumes the generator.
For now, schemas are always inlined.
sourcepub fn sub_schema<T: JsonTypedef>(&mut self) -> Schema
pub fn sub_schema<T: JsonTypedef>(&mut self) -> Schema
Generate a Schema for a given type, adding definitions to the
generator as appropriate.
This is meant to only be used when implementing JsonTypedef for
new types. Most commonly you’ll derive that trait. It’s unlikely you’ll
need to call this method explicitly.