Skip to main content

Module structs

Module structs 

Source

Functions§

can_generate_default_impl
Check if a type’s fields can all be safely defaulted. Primitives, strings, collections, Options, and Duration all have Default impls. Named types (custom structs) only have Default if explicitly marked with has_default=true. If any field is a Named type without has_default, returning true would generate code that calls Default::default() on a type that doesn’t implement it.
field_references_opaque_type
Check if a TypeRef references an opaque type, including through Optional and Vec wrappers. Opaque types use Arc which doesn’t implement Serialize/Deserialize, so any struct with such a field cannot derive those traits.
gen_opaque_struct
Generate an opaque wrapper struct with inner: Arc<core::Type>. For trait types, uses Arc<dyn Type + Send + Sync>. For types with &mut self methods, uses Arc<Mutex<core::Type>>.
gen_opaque_struct_prefixed
Generate an opaque wrapper struct with inner: Arc<core::Type> and a name prefix. For types with &mut self methods, uses Arc<Mutex<core::Type>>.
gen_struct
Generate a struct definition using the builder.
gen_struct_default_impl
Generate a Default impl for a non-opaque binding struct with has_default. All fields use their type’s Default::default(). Optional fields use None instead of Default::default(). This enables the struct to be used with unwrap_or_default() in config constructors.
gen_struct_with_per_field_attrs
Generate a struct definition using the builder, with a per-field attribute callback.
gen_struct_with_rename
Generate a struct definition using the builder, with per-field attribute and name override callbacks.
type_needs_mutex
Check if any method on a type takes &mut self, meaning the opaque wrapper must use Arc<Mutex<T>> instead of Arc<T> to allow interior mutability.