Skip to main content

Module shared

Module shared 

Source

Functions§

can_auto_delegate
Check if all params and return type are delegatable.
can_auto_delegate_function
Check if a free function can be auto-delegated to the core crate. Opaque Named params are allowed (unwrapped via Arc). Non-opaque Named params are not (require From impls that may not exist for types with sanitized fields).
config_constructor_parts
config_constructor_parts_with_options
Generate constructor parameter and assignment lists for types with has_default. All fields become Option with None defaults for optional fields, or unwrap_or_else with actual defaults for required fields.
constructor_parts
Build a constructor parameter list string. Returns (param_list, signature_with_defaults, field_assignments). If param_list exceeds 100 chars, uses multiline format with trailing commas.
format_default_value
Format a DefaultValue as Rust code for the target language. Used by backends generating config constructors with defaults.
function_params
Build a function parameter list.
function_sig_defaults
Build a function signature defaults string (for pyo3 signature etc.).
is_delegatable_param
A param type is delegatable if it’s simple, or a Named type (opaque → Arc unwrap, non-opaque → .into()).
is_delegatable_return
Return types are more permissive — Named types work via .into() (core→binding From exists).
is_delegatable_type
A type is delegatable if it can cross the binding boundary without From impls. Named types are NOT delegatable as function params (may lack From impls). For opaque methods, Named types are handled separately via Arc wrap/unwrap.
is_opaque_delegatable_type
Check if a type is delegatable in the opaque method context. Opaque methods can handle Named params via Arc unwrap and Named returns via Arc wrap.
is_promoted_optional
Returns true if this parameter is required but must be promoted to optional because it follows an optional parameter in the list. PyO3 requires that required params come before all optional params.
is_simple_type
Check if a type is “simple” — can be passed without any conversion.
partition_methods
Partition methods into (instance, static).