Skip to main content

TypeMapper

Struct TypeMapper 

Source
pub struct TypeMapper { /* private fields */ }

Implementations§

Source§

impl TypeMapper

Source

pub fn new(config: TypeMappingConfig) -> Self

Source

pub fn used_features(&self) -> UsedFeatures

Snapshot of crates this mapper has emitted references to. Read after generation by Q2.8 to write REQUIRED_DEPS.toml.

Source

pub fn config(&self) -> &TypeMappingConfig

Borrow the underlying type-mapping config — useful for non-format-mapping toggles (shape, enums, constraints) that other modules need to inspect.

Source

pub fn config_shape_primitive_unions(&self) -> Option<bool>

Q2.7 helper: should anyOf of primitives become an untagged enum with primitive variant types directly (true), or fall back to the pre-Q2.7 type-alias-per-variant shape (false)? Default: true.

Source

pub fn config_shape_additional_properties_typed(&self) -> Option<bool>

Q2.3 helper: should additionalProperties: <schema> produce BTreeMap<String, T> (true) or degrade to BTreeMap<String, serde_json::Value> (false)? Default: true.

Source

pub fn config_constraint_mode(&self) -> ConstraintMode

Q2.4 helper: which constraint-annotation mode is active? Defaults to ConstraintMode::Doc when the [generator.types.constraints] block is absent or its mode field is unset.

Source

pub fn string_format(&self, format: Option<&str>) -> MappedType

Map string + optional format → typed Rust scalar.

Routing:

  1. Apply user-provided + built-in format_aliases.
  2. Dispatch on the normalized format.
  3. Honor each format’s strategy in self.config.
  4. Record any introduced crate in used_features.
Source

pub fn integer_format(&self, format: Option<&str>) -> MappedType

Map integer + optional format → Rust type.

Q2.1: honors uint32 / uint64 (and a few vendor variants like uint) when config.unsigned is true (default). Setting unsigned = false reverts to the pre-Q2.1 behavior where unsigned formats degrade to i64.

Source

pub fn number_format(&self, format: Option<&str>) -> MappedType

Source

pub fn boolean(&self) -> MappedType

Source

pub fn untyped_array(&self) -> MappedType

Source

pub fn dynamic_json(&self) -> MappedType

Source

pub fn null_unit(&self) -> MappedType

Source

pub fn map(&self, ty: OpenApiSchemaType, details: &SchemaDetails) -> MappedType

One-shot dispatch from (OpenApiSchemaType, &SchemaDetails).

Trait Implementations§

Source§

impl Default for TypeMapper

Source§

fn default() -> Self

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

Auto Trait Implementations§

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<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> 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, 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