Skip to main content

Module owned_quote

Module owned_quote 

Source
Expand description

A quote!-based reimplementation of the owned emitter.

This module builds the structural scaffolding as a proc_macro2::TokenStream instead of a concatenation with write!. That scaffolding is the struct definition, Default, the Encode and Decode impls, tagged-field framing, nested structs, and the populated constructor. emit returns the raw token text, plus a banner and the reused default_json and ProtocolRequest tails. The rustfmt pass in crate::fmt, which the regeneration binary runs, formats it.

Reuse guarantees wire correctness. The leaf codec expressions (encode_call, decode_call, encoded_len_expr, and their variants), the import and constant blocks, the default_json tail, and the common-struct files all come verbatim from super::owned, whose bytes the protocol crate’s round-trip and JVM-differential tests already cover. This module rebuilds only the shape around those leaves, which is where the write! templating was densest. parse_tokens lexes each leaf string into tokens.

Functions§

emit
Errors