feat: @timeout_ms codegen — Client::call_with_timeout - #5
Merged
Conversation
A `@timeout_ms = N` annotation on a request/response `function` (frozen into `Function.parameters` as a `Property`) now makes the generated client method call `Client::call_with_timeout(i, ¶ms, core::time::Duration::from_millis(N))` instead of `call`. No annotation -> `call` as before. One-way functions ignore it (nothing to wait for). Only the client stub changes; the trait, dispatcher and params struct are untouched. Bumps the generated crate's `comline-runtime` pin to the rev with `call_with_timeout` (runtime#7). tests/generate.rs: `@timeout_ms = 2500` -> `call_with_timeout(..from_millis(2500))`, an unannotated sibling stays on `call`. tests/compiles.rs gains an `await_ack` fn with `@timeout_ms = 3000` so the compile-against-runtime check exercises the new path.
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.
The codegen half of per-call settings, pairing with runtime#7.
→ the generated client method:
No annotation →
self.0.call(...)as before. One-way functions ignore it (nothing to wait for). Only the client stub changes — trait, dispatcher, params struct untouched.@timeout_msis read fromFunction.parameters(aProperty { name: "timeout_ms", expression }, frozen from the function annotation — core#46). An unparseable value is ignored (falls back tocall).Bumps the generated crate's
comline-runtimepin to the rev withcall_with_timeout.Tests
tests/generate.rs—@timeout_ms = 2500emitscall_with_timeout(.., from_millis(2500)), an unannotated sibling stays oncall.tests/compiles.rsgains anawait_ackfn with@timeout_ms = 3000so the compile-against-comline-runtimecheck exercises it. 7 string tests + 1 compile test green.That closes the "deepen the generator" trio (borrowed args · one-way · per-call settings).