pub struct Config {
pub parser: ParserConfig,
pub interpreter: InterpreterConfig,
pub optimizer: OptimizerConfig,
pub generator: GeneratorConfig,
pub renderer: RendererConfig,
}Expand description
Configuration structure for the generate method.
Fields§
§parser: ParserConfigConfiguration for the schema parser.
interpreter: InterpreterConfigConfiguration for the schema interpreter.
optimizer: OptimizerConfigConfiguration for the type information optimizer.
generator: GeneratorConfigConfiguration for the code generator.
renderer: RendererConfigConfiguration for the code renderer.
Implementations§
Source§impl Config
impl Config
Sourcepub fn with_schema<T>(self, schema: T) -> Self
pub fn with_schema<T>(self, schema: T) -> Self
Adds the passed schema to the list of schemas to parse.
Sourcepub fn with_schemas<I>(self, schemas: I) -> Self
pub fn with_schemas<I>(self, schemas: I) -> Self
Adds the passed schemas to the list of schemas to parse.
Sourcepub fn set_parser_flags(self, flags: ParserFlags) -> Self
pub fn set_parser_flags(self, flags: ParserFlags) -> Self
Set parser flags to the config.
Sourcepub fn with_parser_flags(self, flags: ParserFlags) -> Self
pub fn with_parser_flags(self, flags: ParserFlags) -> Self
Add parser flags to the config.
Sourcepub fn without_parser_flags(self, flags: ParserFlags) -> Self
pub fn without_parser_flags(self, flags: ParserFlags) -> Self
Remove parser flags to the config.
Sourcepub fn set_interpreter_flags(self, flags: InterpreterFlags) -> Self
pub fn set_interpreter_flags(self, flags: InterpreterFlags) -> Self
Set interpreter flags to the config.
Sourcepub fn with_interpreter_flags(self, flags: InterpreterFlags) -> Self
pub fn with_interpreter_flags(self, flags: InterpreterFlags) -> Self
Add code interpreter flags to the config.
Sourcepub fn without_interpreter_flags(self, flags: InterpreterFlags) -> Self
pub fn without_interpreter_flags(self, flags: InterpreterFlags) -> Self
Remove code interpreter flags to the config.
Sourcepub fn set_optimizer_flags(self, flags: OptimizerFlags) -> Self
pub fn set_optimizer_flags(self, flags: OptimizerFlags) -> Self
Set optimizer flags to the config.
Sourcepub fn with_optimizer_flags(self, flags: OptimizerFlags) -> Self
pub fn with_optimizer_flags(self, flags: OptimizerFlags) -> Self
Add optimizer flags to the config.
Sourcepub fn without_optimizer_flags(self, flags: OptimizerFlags) -> Self
pub fn without_optimizer_flags(self, flags: OptimizerFlags) -> Self
Remove optimizer flags to the config.
Sourcepub fn set_generator_flags(self, flags: GeneratorFlags) -> Self
pub fn set_generator_flags(self, flags: GeneratorFlags) -> Self
Set generator flags to the config.
Sourcepub fn with_generator_flags(self, flags: GeneratorFlags) -> Self
pub fn with_generator_flags(self, flags: GeneratorFlags) -> Self
Add code generator flags to the config.
Sourcepub fn without_generator_flags(self, flags: GeneratorFlags) -> Self
pub fn without_generator_flags(self, flags: GeneratorFlags) -> Self
Remove code generator flags to the config.
Sourcepub fn set_renderer_flags(self, flags: RendererFlags) -> Self
pub fn set_renderer_flags(self, flags: RendererFlags) -> Self
Set renderer flags to the config.
Sourcepub fn with_renderer_flags(self, flags: RendererFlags) -> Self
pub fn with_renderer_flags(self, flags: RendererFlags) -> Self
Add code renderer flags to the config.
Sourcepub fn without_renderer_flags(self, flags: RendererFlags) -> Self
pub fn without_renderer_flags(self, flags: RendererFlags) -> Self
Remove code renderer flags to the config.
Sourcepub fn set_box_flags(self, flags: BoxFlags) -> Self
pub fn set_box_flags(self, flags: BoxFlags) -> Self
Set boxing flags to the code generator config.
Sourcepub fn with_box_flags(self, flags: BoxFlags) -> Self
pub fn with_box_flags(self, flags: BoxFlags) -> Self
Add boxing flags to the code generator config.
Sourcepub fn without_box_flags(self, flags: BoxFlags) -> Self
pub fn without_box_flags(self, flags: BoxFlags) -> Self
Remove boxing flags to the code generator config.
Sourcepub fn with_render_step<T>(self, step: T) -> Selfwhere
T: RenderStepConfig + 'static,
pub fn with_render_step<T>(self, step: T) -> Selfwhere
T: RenderStepConfig + 'static,
Adds the passed step to the config.
If the same type of renderer was already added, it is replaced by the new one.
Sourcepub fn with_render_steps<I>(self, steps: I) -> Self
pub fn with_render_steps<I>(self, steps: I) -> Self
Add multiple renderers to the generator config.
See with_render_step for details.
Sourcepub fn with_quick_xml_serialize(self) -> Self
pub fn with_quick_xml_serialize(self) -> Self
Enable code generation for quick_xml serialization.
Sourcepub fn with_quick_xml_serialize_config(
self,
namespaces: NamespaceSerialization,
default_namespace: Option<Namespace>,
) -> Self
pub fn with_quick_xml_serialize_config( self, namespaces: NamespaceSerialization, default_namespace: Option<Namespace>, ) -> Self
Enable code generation for quick_xml serialization.
Sourcepub fn with_quick_xml_deserialize(self) -> Self
pub fn with_quick_xml_deserialize(self) -> Self
Enable code generation for quick_xml deserialization with the default settings.
Sourcepub fn with_quick_xml_deserialize_config(self, boxed_deserializer: bool) -> Self
pub fn with_quick_xml_deserialize_config(self, boxed_deserializer: bool) -> Self
Enable render steps for quick_xml deserialization
with the passed configuration.
Sourcepub fn with_quick_xml(self) -> Self
pub fn with_quick_xml(self) -> Self
Enable render steps for quick_xml serialization and deserialization
with the default settings.
Sourcepub fn with_quick_xml_config(
self,
namespace_serialization: NamespaceSerialization,
default_serialize_namespace: Option<Namespace>,
boxed_deserializer: bool,
) -> Self
pub fn with_quick_xml_config( self, namespace_serialization: NamespaceSerialization, default_serialize_namespace: Option<Namespace>, boxed_deserializer: bool, ) -> Self
Enable render steps for quick_xml serialization and deserialization
with the passed configuration.
Sourcepub fn with_serde_quick_xml(self) -> Self
pub fn with_serde_quick_xml(self) -> Self
Enable render steps for types with quick_xml serde support.
Sourcepub fn with_serde_xml_rs(self, version: SerdeXmlRsVersion) -> Self
pub fn with_serde_xml_rs(self, version: SerdeXmlRsVersion) -> Self
Enable render steps for types with quick_xml serde support.
Sourcepub fn with_advanced_enums(self) -> Self
pub fn with_advanced_enums(self) -> Self
Enable support for advanced enums.
Advanced enums will automatically add constants for each enum variant
using its simple base type. During deserialization, the base type is
deserialized first and then compared against the defined constants to
determine the actual enum variant. This is useful for type like QName
where the actual used prefix can change, but the name still refers to
the object.
Sourcepub fn with_namespace<P, N>(self, prefix: P, namespace: N) -> Self
pub fn with_namespace<P, N>(self, prefix: P, namespace: N) -> Self
Add a namespace to the parser config.
See ParserConfig::namespaces for more details.
Sourcepub fn with_namespaces<I, P, N>(self, namespaces: I) -> Self
pub fn with_namespaces<I, P, N>(self, namespaces: I) -> Self
Add multiple namespaces to the parser config.
See ParserConfig::namespaces for more details.
Sourcepub fn with_generate<I>(self, types: I) -> Self
pub fn with_generate<I>(self, types: I) -> Self
Set the types the code should be generated for.
Sourcepub fn with_typedef_mode(self, mode: TypedefMode) -> Self
pub fn with_typedef_mode(self, mode: TypedefMode) -> Self
Set the typedef mode for the generator.
Sourcepub fn with_derive<I>(self, derive: I) -> Self
pub fn with_derive<I>(self, derive: I) -> Self
Set the traits the generated types should derive from.
Sourcepub fn with_any_type_support(self) -> Self
pub fn with_any_type_support(self) -> Self
Enable support for xs:any types.
Sourcepub fn with_any_types<S, T>(self, any_type: S, any_attributes_type: T) -> Self
pub fn with_any_types<S, T>(self, any_type: S, any_attributes_type: T) -> Self
Set the types to use to handle xs:any and xs:anyAttribute elements.
Sourcepub fn with_mixed_type_support(self) -> Self
pub fn with_mixed_type_support(self) -> Self
Enable support for mixed types.
Sourcepub fn with_mixed_types<S, T>(self, text_type: S, mixed_type: T) -> Self
pub fn with_mixed_types<S, T>(self, text_type: S, mixed_type: T) -> Self
Set the types to use to handle mixed types and text data.
Sourcepub fn with_nillable_type_support(self) -> Self
pub fn with_nillable_type_support(self) -> Self
Enable support for nillable types.
Sourcepub fn with_nillable_type<S>(self, nillable_type: S) -> Self
pub fn with_nillable_type<S>(self, nillable_type: S) -> Self
Set the type to use to handle nillable elements.
Sourcepub fn with_naming<X>(self, naming: X) -> Selfwhere
X: Naming + 'static,
pub fn with_naming<X>(self, naming: X) -> Selfwhere
X: Naming + 'static,
Set the Naming trait that is used to generated names in the interpreter.
Sourcepub fn with_type<I, M>(self, ident: I, meta: M) -> Self
pub fn with_type<I, M>(self, ident: I, meta: M) -> Self
Add a type to the interpreter.
This can be used to add or overwrite type definitions to the interpreter,
for example to support xs:anySimpleType with a custom type.
§Parameters
ident: Identifier quadruple for the type to add/overwrite, for example(IdentType::Type, Namespace::XS, "anySimpleType")forxs:anySimpleType.meta: The type definition to use for the specified identifier.
Sourcepub fn with_xs_any_simple_type<S>(self, path: S) -> Self
pub fn with_xs_any_simple_type<S>(self, path: S) -> Self
Add a type to the interpreter that should be used to handle xs:anySimpleType.
This is a convenient method for adding support for xs:anySimpleType with a custom type.
§Parameters
path: The path to the type to use for handlingxs:anySimpleType, for example"xsd_parser_types::xml::AnySimpleType".
Sourcepub fn with_qname_type(self) -> Self
pub fn with_qname_type(self) -> Self
Add a type definition for xs:QName that uses the xsd_parser_types::xml::QName type.
Sourcepub fn with_qname_type_from(self, path: &str) -> Self
pub fn with_qname_type_from(self, path: &str) -> Self
Add a type definition for xs:QName that uses the type defined at the passed path.
Sourcepub fn with_type_postfix<S>(self, value: S) -> Self
pub fn with_type_postfix<S>(self, value: S) -> Self
Set the postfix that should be applied to the name of types.
For details please refer to GeneratorConfig::type_postfix.
Sourcepub fn with_element_postfix<S>(self, value: S) -> Self
pub fn with_element_postfix<S>(self, value: S) -> Self
Set the postfix that should be applied to the name of elements.
For details please refer to GeneratorConfig::type_postfix.
Sourcepub fn with_element_type_postfix<S>(self, value: S) -> Self
pub fn with_element_type_postfix<S>(self, value: S) -> Self
Set the postfix that should be applied to the name of element types.
For details please refer to GeneratorConfig::type_postfix.
Sourcepub fn with_nillable_content_postfix<S>(self, value: S) -> Self
pub fn with_nillable_content_postfix<S>(self, value: S) -> Self
Set the postfix that should be applied to the name of nillable content types.
For details please refer to GeneratorConfig::type_postfix.
Sourcepub fn with_dynamic_element_postfix<S>(self, value: S) -> Self
pub fn with_dynamic_element_postfix<S>(self, value: S) -> Self
Set the postfix that should be applied to the name of dynamic elements.
For details please refer to GeneratorConfig::type_postfix.