feat(rust): honour GenRequest.default_framing as the per-package fallback - #10
Merged
Conversation
…back
A protocol's framing now resolves most-specific-first:
1. its own `@framing` annotation
2. the package `default_framing` (comline.toml, via GenRequest)
3. the datagram default
`@framing = "datagram"` (or `"comline.datagram"`) is now recognised too, so
a single protocol can opt back to datagram when the package default is
`jsonrpc`. An unrecognised name at either level falls through to the next.
Output is unchanged whenever `default_framing` is None and no protocol names
`datagram` explicitly — the conformance goldens don't move.
Bumps the comline-codegen pin to generation c70336d (the rev that adds
GenRequest.default_framing).
tests:
- generate.rs: package default applies to an unannotated protocol;
`@framing = "datagram"` beats a `jsonrpc` package default
- compiles.rs: one crate now builds all three resolutions at once —
`chat` opts out to datagram, `clock` takes the default, `rpc` names it
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR 2 of the
default_framingchain (after generation#17).A protocol's framing now resolves most-specific-first:
@framingannotationdefault_framing—comline.toml's[generate] default_framing, carried onGenRequestNew:
@framing = "datagram"(comline.datagram) is a recognised value, so one protocol can opt back to datagram when the package default isjsonrpc. An unrecognised name at either level falls through to the next.Output is byte-identical to before whenever
default_framingisNoneand nothing namesdatagramexplicitly — conformance goldens unaffected.comline-codegenpin to generationc70336d.generate.rs: package default reaches an unannotated protocol;@framing = "datagram"beats ajsonrpcpackage default.compiles.rs: one generated crate now builds all three resolution paths —chatopts out to datagram,clocktakes the default,rpcnamesjsonrpcitself.