pub struct TypeSpaceSettings { /* private fields */ }
Expand description
Settings that alter type generation.
Implementations§
source§impl TypeSpaceSettings
impl TypeSpaceSettings
sourcepub fn with_type_mod<S: AsRef<str>>(&mut self, type_mod: S) -> &mut Self
pub fn with_type_mod<S: AsRef<str>>(&mut self, type_mod: S) -> &mut Self
Set the name of the path prefix for types defined in this TypeSpace.
sourcepub fn with_derive(&mut self, derive: String) -> &mut Self
pub fn with_derive(&mut self, derive: String) -> &mut Self
Add an additional derive macro to apply to all defined types.
sourcepub fn with_struct_builder(&mut self, struct_builder: bool) -> &mut Self
pub fn with_struct_builder(&mut self, struct_builder: bool) -> &mut Self
For structs, include a “builder” type that can be used to construct it.
sourcepub fn with_replacement<TS: ToString, RS: ToString, I: Iterator<Item = TypeSpaceImpl>>(
&mut self,
type_name: TS,
replace_type: RS,
impls: I,
) -> &mut Self
pub fn with_replacement<TS: ToString, RS: ToString, I: Iterator<Item = TypeSpaceImpl>>( &mut self, type_name: TS, replace_type: RS, impls: I, ) -> &mut Self
Replace a referenced type with a named type. This causes the referenced
type not to be generated. If the same type_name
is specified multiple times,
the last one is honored.
sourcepub fn with_patch<S: ToString>(
&mut self,
type_name: S,
type_patch: &TypeSpacePatch,
) -> &mut Self
pub fn with_patch<S: ToString>( &mut self, type_name: S, type_patch: &TypeSpacePatch, ) -> &mut Self
Modify a type with the given name. Note that specifying a type not
created by the input JSON schema does not result in an error and is
silently ignored. If the same type_name
is specified multiple times,
the last one is honored.
sourcepub fn with_conversion<S: ToString, I: Iterator<Item = TypeSpaceImpl>>(
&mut self,
schema: SchemaObject,
type_name: S,
impls: I,
) -> &mut Self
pub fn with_conversion<S: ToString, I: Iterator<Item = TypeSpaceImpl>>( &mut self, schema: SchemaObject, type_name: S, impls: I, ) -> &mut Self
Replace a given schema with a named type. The given schema must precisely
match the schema from the input, including fields such as description
.
Typical usage is to map a schema definition to a builtin type or type
provided by a crate, such as 'rust_decimal::Decimal'
. If the same schema
is specified multiple times, the first one is honored.
sourcepub fn with_unknown_crates(&mut self, policy: UnknownPolicy) -> &mut Self
pub fn with_unknown_crates(&mut self, policy: UnknownPolicy) -> &mut Self
Type schemas may contain an extension (x-rust-type
) that indicates
the corresponding Rust type within a particular crate. This function
changes the disposition regarding crates not otherwise specified via
Self::with_crate
. The default value is false
.
sourcepub fn with_crate<S1: ToString>(
&mut self,
crate_name: S1,
version: CrateVers,
rename: Option<&String>,
) -> &mut Self
pub fn with_crate<S1: ToString>( &mut self, crate_name: S1, version: CrateVers, rename: Option<&String>, ) -> &mut Self
Type schemas may contain an extension (x-rust-type
) that indicates
the corresponding Rust type within a particular crate. This extension
indicates the crate, version compatibility, type path, and type
parameters. This function modifies settings to use (rather than
generate) types from the given crate and version. The version should
precisely match the version of the crate that you expect as a
dependency.
Trait Implementations§
source§impl Clone for TypeSpaceSettings
impl Clone for TypeSpaceSettings
source§fn clone(&self) -> TypeSpaceSettings
fn clone(&self) -> TypeSpaceSettings
1.6.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for TypeSpaceSettings
impl Debug for TypeSpaceSettings
source§impl Default for TypeSpaceSettings
impl Default for TypeSpaceSettings
source§fn default() -> TypeSpaceSettings
fn default() -> TypeSpaceSettings
Auto Trait Implementations§
impl Freeze for TypeSpaceSettings
impl RefUnwindSafe for TypeSpaceSettings
impl Send for TypeSpaceSettings
impl Sync for TypeSpaceSettings
impl Unpin for TypeSpaceSettings
impl UnwindSafe for TypeSpaceSettings
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)