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).
Like can_auto_delegate but permits non-opaque Named &T params (and &[T] / &[&str]
slices), because the caller emits owned _core let-bindings and passes a borrow of them.
Generate constructor parameter and assignment lists for types with has_default.
All fields become Option<T> with None defaults for optional fields,
or unwrap_or_else with actual defaults for required fields.
Like config_constructor_parts_with_renames but includes assignments for cfg-gated fields
force-restored via never_skip_cfg_field_names (emitted as field: Default::default()).
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.
Like constructor_parts but with optional field renames for keyword escaping.
field_renames maps original field name → binding field name (e.g. “class” → “class_”).
Parameters keep the original name (valid in Rust), struct literal uses the renamed field.
Like constructor_parts_with_renames but also includes assignments for cfg-gated fields
that have been force-restored via trait-bridge bind_via = "options_field". Such fields
are absent from the constructor parameter list but must be present in the Self { ... }
struct literal — emitted as field: Default::default() so the binding struct compiles.
Per-parameter name: type strings, before joining. Callers that render the signature
across multiple lines (long-signature wrapping) must reuse this exact list rather than
recomputing types — a separate recomputation diverges from the backend-aware mapping used
for the single-line form (e.g. extendr’s Nullable<&T>), producing a signature whose types
disagree with the generated body and fail to compile.
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.
A Named param with is_ref=true needs a let-binding (can’t inline .into() + borrow).
A Vec<String> param with is_ref=true needs conversion to Vec<&str>.
A Vec<NonOpaqueNamed> param with is_ref=true needs a let-binding (gen_php_call_args emits
&{name}_core[..] which is only valid when a let binding for {name}_core exists).
Public alias for use by backend-specific codegen (e.g. napi types.rs opaque delegate check).
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.
Recursively replace Named(n) references where n is excluded from the binding’s public surface
(e.g. InternalDocument) with TypeRef::Json. An excluded type is never emitted as a binding
declaration, so a trait-bridge interface/stub method referencing it would be an undefined name;
the runtime bridge marshals such values as JSON, so Json is the faithful stand-in. Shared by
the go/pyo3/napi/magnus excluded-type handling so the substitution stays identical across them.
Recursively replace Named(n) references where n is a trait exposed via a host-implementable
RBS/language interface (e.g. DocumentExtractor) with TypeRef::Named("_{n}"). Traits are never
emitted as a class/struct declaration themselves — the trait-bridge backend surfaces them as an
interface _TraitName (or the target language’s equivalent) that host code implements, so a
signature referencing the bare trait name would be an undeclared type. Shared so the substitution
stays identical across generators that need it (currently Ruby/Magnus RBS stubs).