Struct typify::TypeSpaceSettings
source · pub struct TypeSpaceSettings { /* private fields */ }Expand description
Settings that alter type generation.
Implementations§
source§impl TypeSpaceSettings
impl TypeSpaceSettings
sourcepub fn with_type_mod<S>(&mut self, type_mod: S) -> &mut TypeSpaceSettingswhere
S: AsRef<str>,
pub fn with_type_mod<S>(&mut self, type_mod: S) -> &mut TypeSpaceSettingswhere S: AsRef<str>,
Set the name of the path prefix for types defined in this TypeSpace.
sourcepub fn with_derive(&mut self, derive: String) -> &mut TypeSpaceSettings
pub fn with_derive(&mut self, derive: String) -> &mut TypeSpaceSettings
Add an additional derive macro to apply to all defined types.
sourcepub fn with_struct_builder(
&mut self,
struct_builder: bool
) -> &mut TypeSpaceSettings
pub fn with_struct_builder( &mut self, struct_builder: bool ) -> &mut TypeSpaceSettings
For structs, include a “builder” type that can be used to construct it.
sourcepub fn with_replacement<TS, RS, I>(
&mut self,
type_name: TS,
replace_type: RS,
impls: I
) -> &mut TypeSpaceSettingswhere
TS: ToString,
RS: ToString,
I: Iterator<Item = TypeSpaceImpl>,
pub fn with_replacement<TS, RS, I>( &mut self, type_name: TS, replace_type: RS, impls: I ) -> &mut TypeSpaceSettingswhere TS: ToString, RS: ToString, I: Iterator<Item = TypeSpaceImpl>,
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>(
&mut self,
type_name: S,
type_patch: &TypeSpacePatch
) -> &mut TypeSpaceSettingswhere
S: ToString,
pub fn with_patch<S>( &mut self, type_name: S, type_patch: &TypeSpacePatch ) -> &mut TypeSpaceSettingswhere S: ToString,
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, I>(
&mut self,
schema: SchemaObject,
type_name: S,
impls: I
) -> &mut TypeSpaceSettingswhere
S: ToString,
I: Iterator<Item = TypeSpaceImpl>,
pub fn with_conversion<S, I>( &mut self, schema: SchemaObject, type_name: S, impls: I ) -> &mut TypeSpaceSettingswhere S: ToString, I: Iterator<Item = TypeSpaceImpl>,
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.
Trait Implementations§
source§impl Clone for TypeSpaceSettings
impl Clone for TypeSpaceSettings
source§fn clone(&self) -> TypeSpaceSettings
fn clone(&self) -> TypeSpaceSettings
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more