Skip to main content

Config

Struct Config 

Source
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: ParserConfig

Configuration for the schema parser.

§interpreter: InterpreterConfig

Configuration for the schema interpreter.

§optimizer: OptimizerConfig

Configuration for the type information optimizer.

§generator: GeneratorConfig

Configuration for the code generator.

§renderer: RendererConfig

Configuration for the code renderer.

Implementations§

Source§

impl Config

Source

pub fn with_schema<T>(self, schema: T) -> Self
where T: Into<Schema>,

Adds the passed schema to the list of schemas to parse.

Source

pub fn with_schemas<I>(self, schemas: I) -> Self
where I: IntoIterator, I::Item: Into<Schema>,

Adds the passed schemas to the list of schemas to parse.

Source

pub fn set_parser_flags(self, flags: ParserFlags) -> Self

Set parser flags to the config.

Source

pub fn with_parser_flags(self, flags: ParserFlags) -> Self

Add parser flags to the config.

Source

pub fn without_parser_flags(self, flags: ParserFlags) -> Self

Remove parser flags to the config.

Source

pub fn set_interpreter_flags(self, flags: InterpreterFlags) -> Self

Set interpreter flags to the config.

Source

pub fn with_interpreter_flags(self, flags: InterpreterFlags) -> Self

Add code interpreter flags to the config.

Source

pub fn without_interpreter_flags(self, flags: InterpreterFlags) -> Self

Remove code interpreter flags to the config.

Source

pub fn set_optimizer_flags(self, flags: OptimizerFlags) -> Self

Set optimizer flags to the config.

Source

pub fn with_optimizer_flags(self, flags: OptimizerFlags) -> Self

Add optimizer flags to the config.

Source

pub fn without_optimizer_flags(self, flags: OptimizerFlags) -> Self

Remove optimizer flags to the config.

Source

pub fn set_generator_flags(self, flags: GeneratorFlags) -> Self

Set generator flags to the config.

Source

pub fn with_generator_flags(self, flags: GeneratorFlags) -> Self

Add code generator flags to the config.

Source

pub fn without_generator_flags(self, flags: GeneratorFlags) -> Self

Remove code generator flags to the config.

Source

pub fn set_renderer_flags(self, flags: RendererFlags) -> Self

Set renderer flags to the config.

Source

pub fn with_renderer_flags(self, flags: RendererFlags) -> Self

Add code renderer flags to the config.

Source

pub fn without_renderer_flags(self, flags: RendererFlags) -> Self

Remove code renderer flags to the config.

Source

pub fn set_box_flags(self, flags: BoxFlags) -> Self

Set boxing flags to the code generator config.

Source

pub fn with_box_flags(self, flags: BoxFlags) -> Self

Add boxing flags to the code generator config.

Source

pub fn without_box_flags(self, flags: BoxFlags) -> Self

Remove boxing flags to the code generator config.

Source

pub fn with_render_step<T>(self, step: T) -> Self
where 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.

Source

pub fn with_render_steps<I>(self, steps: I) -> Self
where I: IntoIterator, I::Item: RenderStepConfig + 'static,

Add multiple renderers to the generator config.

See with_render_step for details.

Source

pub fn with_quick_xml_serialize(self) -> Self

Enable code generation for quick_xml serialization.

Source

pub fn with_quick_xml_serialize_config( self, namespaces: NamespaceSerialization, default_namespace: Option<Namespace>, ) -> Self

Enable code generation for quick_xml serialization.

Source

pub fn with_quick_xml_deserialize(self) -> Self

Enable code generation for quick_xml deserialization with the default settings.

Source

pub fn with_quick_xml_deserialize_config(self, boxed_deserializer: bool) -> Self

Enable render steps for quick_xml deserialization with the passed configuration.

Source

pub fn with_quick_xml(self) -> Self

Enable render steps for quick_xml serialization and deserialization with the default settings.

Source

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.

Source

pub fn with_serde_quick_xml(self) -> Self

Enable render steps for types with quick_xml serde support.

Source

pub fn with_serde_xml_rs(self, version: SerdeXmlRsVersion) -> Self

Enable render steps for types with quick_xml serde support.

Source

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.

Source

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.

Source

pub fn with_namespaces<I, P, N>(self, namespaces: I) -> Self

Add multiple namespaces to the parser config.

See ParserConfig::namespaces for more details.

Source

pub fn with_generate<I>(self, types: I) -> Self

Set the types the code should be generated for.

Source

pub fn with_typedef_mode(self, mode: TypedefMode) -> Self

Set the typedef mode for the generator.

Source

pub fn with_derive<I>(self, derive: I) -> Self
where I: IntoIterator, I::Item: Into<String>,

Set the traits the generated types should derive from.

Source

pub fn with_any_type_support(self) -> Self

Enable support for xs:any types.

Source

pub fn with_any_types<S, T>(self, any_type: S, any_attributes_type: T) -> Self
where S: Into<String>, T: Into<String>,

Set the types to use to handle xs:any and xs:anyAttribute elements.

Source

pub fn with_mixed_type_support(self) -> Self

Enable support for mixed types.

Source

pub fn with_mixed_types<S, T>(self, text_type: S, mixed_type: T) -> Self
where S: Into<String>, T: Into<String>,

Set the types to use to handle mixed types and text data.

Source

pub fn with_nillable_type_support(self) -> Self

Enable support for nillable types.

Source

pub fn with_nillable_type<S>(self, nillable_type: S) -> Self
where S: Into<String>,

Set the type to use to handle nillable elements.

Source

pub fn with_naming<X>(self, naming: X) -> Self
where X: Naming + 'static,

Set the Naming trait that is used to generated names in the interpreter.

Source

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") for xs:anySimpleType.
  • meta: The type definition to use for the specified identifier.
Source

pub fn with_xs_any_simple_type<S>(self, path: S) -> Self
where S: AsRef<str>,

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 handling xs:anySimpleType, for example "xsd_parser_types::xml::AnySimpleType".
Source

pub fn with_qname_type(self) -> Self

Add a type definition for xs:QName that uses the xsd_parser_types::xml::QName type.

Source

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.

Source

pub fn with_type_postfix<S>(self, value: S) -> Self
where S: Into<String>,

Set the postfix that should be applied to the name of types.

For details please refer to GeneratorConfig::type_postfix.

Source

pub fn with_element_postfix<S>(self, value: S) -> Self
where S: Into<String>,

Set the postfix that should be applied to the name of elements.

For details please refer to GeneratorConfig::type_postfix.

Source

pub fn with_element_type_postfix<S>(self, value: S) -> Self
where S: Into<String>,

Set the postfix that should be applied to the name of element types.

For details please refer to GeneratorConfig::type_postfix.

Source

pub fn with_nillable_content_postfix<S>(self, value: S) -> Self
where S: Into<String>,

Set the postfix that should be applied to the name of nillable content types.

For details please refer to GeneratorConfig::type_postfix.

Source

pub fn with_dynamic_element_postfix<S>(self, value: S) -> Self
where S: Into<String>,

Set the postfix that should be applied to the name of dynamic elements.

For details please refer to GeneratorConfig::type_postfix.

Trait Implementations§

Source§

impl Clone for Config

Source§

fn clone(&self) -> Config

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Config

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Config

Source§

fn default() -> Config

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Config

§

impl !RefUnwindSafe for Config

§

impl !Send for Config

§

impl !Sync for Config

§

impl Unpin for Config

§

impl UnsafeUnpin for Config

§

impl !UnwindSafe for Config

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<X> AsAny for X
where X: 'static,

Source§

fn into_any(self: Box<X>) -> Box<dyn Any>

Convert the boxed object into a boxed any.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Get a reference to the current object as Any.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Get a mutable reference to the current object as Any.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,