Skip to main content

wire_ref

Function wire_ref 

Source
pub fn wire_ref(t: &TypeRef, _types: &HashMap<String, Arc<TypeDecl>>) -> WireRef
Expand description

Resolve one TypeRef occurrence (a field’s type, a variant payload field’s type, a generic argument) into its WireRef shape — the same dispatch emit_field_deserialise performs today, one level removed from any TS string.

types is threaded through for signature symmetry with the walks above and forward compatibility with a future disambiguation need; this resolution is single-level (unlike collect_type_names’s transitive walk) and does not currently consult it.

This encodes the deserialise-side dispatch only (mirroring emit_field_deserialise’s arms one-for-one, including its Effect / HttpResult arm, which it folds into the same unchecked cast as ValidationError/JsonError/QueueResult). The emitter does not actually agree with itself on those two shapes across its other three dispatches: serialise_field_expr_via recurses through Effect rather than casting it unchecked, deserialise_expr_via also recurses through Effect, and codec_suffix gives both Effect and HttpResult their own composed names (Effect_<inner>, HttpResult_<inner>) rather than treating them as opaque. A future serialise-side or codec-suffix-side WireRef derivation must not assume this function’s Unchecked answer already covers it — that would silently change Effect-at-field- position from “recurse into the inner type” to “cast unchecked” the moment Phase 2 routes the serialise path through this same resolver. Reconciling (or deliberately keeping two resolvers) is a Phase 2 decision, not implied by this function’s existence.