Skip to main content

message_to_wire_best

Function message_to_wire_best 

Source
pub fn message_to_wire_best(
    from: &str,
    value: &RuntimeValue,
    goal: WireGoal,
) -> Result<Vec<u8>, String>
Expand description

The no-brainer encoder — “just use this.” Picks the Pareto-optimal dial combination for goal and ships it. Because every wire form is self-describing by its leading tag, this is purely an ENCODE-side decision: the decoder reconstructs via message_from_wire with no hint, so best interoperates with every existing peer.

Smallest measures the FULL cross product of the size-affecting dials (numerics × structure × float-coding × compression) and returns the minimum. Because every single-dial configuration is literally one of the candidates, the result is provably never larger than ANY single knob — on any workload. Fastest returns the fixed memcpy-decode form directly. (Smallest pays N encode passes for the minimum bytes; it is the opt-in “I am bandwidth-bound” choice, not the default.)