pub struct UnionCodegen {
pub type_name: Option<String>,
pub derive: Option<Vec<String>>,
pub variant_types: Option<bool>,
pub variant_types_suffix: Option<String>,
}Expand description
Codegen settings for union types.
Corresponds to $types.union-codegen in the schema.
Used via $ext-type.codegen on union type definitions.
Includes flattened fields from $types.base-codegen.
§Example
@ $types.my-union {
$variant: union
$codegen {
type = "MyUnion"
variant-types = true
variant-types-suffix = "Variant"
}
variants.a = `text`
variants.b = `integer`
}Fields§
§type_name: Option<String>Override the generated type name (from base-codegen).
derive: Option<Vec<String>>Override the list of derive macros (from base-codegen).
variant_types: Option<bool>Generate separate types for each variant instead of struct-like variants.
variant_types_suffix: Option<String>Suffix for variant type names (e.g., “Type” -> TextType, IntegerType).
Trait Implementations§
Source§impl Clone for UnionCodegen
impl Clone for UnionCodegen
Source§fn clone(&self) -> UnionCodegen
fn clone(&self) -> UnionCodegen
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for UnionCodegen
impl Debug for UnionCodegen
Source§impl Default for UnionCodegen
impl Default for UnionCodegen
Source§fn default() -> UnionCodegen
fn default() -> UnionCodegen
Returns the “default value” for a type. Read more
Source§impl<'doc> ParseDocument<'doc> for UnionCodegen
impl<'doc> ParseDocument<'doc> for UnionCodegen
Source§type Error = ParseError
type Error = ParseError
The error type returned by parsing.
Auto Trait Implementations§
impl Freeze for UnionCodegen
impl RefUnwindSafe for UnionCodegen
impl Send for UnionCodegen
impl Sync for UnionCodegen
impl Unpin for UnionCodegen
impl UnwindSafe for UnionCodegen
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
Mutably borrows from an owned value. Read more