Skip to main content

Module mut_writeback

Module mut_writeback 

Source
Expand description

Policy for &mut T parameters that a generated binding must hand back to its caller.

A core function shaped like fn tag_record(record: &mut Record) cannot be bound as an owned by-value parameter returning void: every backend converts the host DTO into an owned _core intermediate, mutates that, and drops it. The caller’s value is untouched and there is no diagnostic — the call silently does nothing.

Every backend that lowers such a parameter must consult this module so the eight host languages agree on one answer instead of each inventing its own.

The supported shape is exactly one &mut T DTO parameter on a unit-returning function. The binding then returns the updated T. Any other &mut DTO shape is rejected at generation time by reject_unsupported_writeback rather than emitted lossily.

Functions§

effective_return_type
The return type a binding must declare in place of return_type, when a write-back applies.
is_writeback_param
Whether param is a &mut T parameter whose T is a non-opaque (serde DTO) named type.
reject_unsupported_writeback
Reject &mut T DTO shapes no host language in the matrix can express.
writeback_param
The single &mut T DTO parameter a binding must write back, when the signature is supported.
writeback_params
Every &mut T DTO parameter in params, in declaration order.
writeback_type_name
The named DTO type a binding must return for param, e.g. Record for record: &mut Record.