feat: one-way codegen for _return: None (Client::notify) - #4
Merged
Conversation
A no-return `function` (no `->` at all) now generates fire-and-forget: - provider trait method is `fn f(&self, args);` — no `Result`, no error type (a `!` on a one-way fn is dropped: nowhere to deliver it) - the dispatcher arm decodes params, runs the handler, writes no Envelope; the runtime's Server (comline-runtime#6) then replies with nothing - the client method is `pub fn f(&mut self, args) -> Result<(), RuntimeError>` over `Client::notify` — no `CallError<E>` - no per-function error enum is emitted for it - when *every* function in a protocol is one-way, the dispatch `out` param is named `_out` `_return: Some(KindValue::Unit)` (an explicit `-> ()`) is unchanged — request/response with an empty ack. So `KindValue::Unit` finally earns its keep: `commit() -> ()` confirms, `log(msg)` doesn't (§4.4). Bumps the generated crate's `comline-runtime` pin to the rev with `Client::notify`. tests/compiles.rs's `poke` (already `_return: None`) now exercises the notify path end to end against comline-runtime.
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.
Second of the deferred §4.2 refinements, pairing with runtime#6.
A no-return
function(no->at all) now generates fire-and-forget:fn f(&self, …) -> Result<(), FError>fn f(&self, …);enum FError {}emitted!on a one-way fn is droppedEnvelope-> Result<(), CallError<FError>>overClient::call-> Result<(), RuntimeError>overClient::notifyWhen every function in a protocol is one-way, the dispatch
outparam is named_out._return: Some(KindValue::Unit)(an explicit-> ()) is unchanged — request/response with an empty ack. SoKindValue::Unitfinally earns its keep:commit() -> ()confirms,log(msg)doesn't (§4.4).Bumps the generated crate's
comline-runtimepin to the rev withClient::notify.tests/compiles.rs'spoke(already_return: None) now exercises the notify path end to end againstcomline-runtime; string coverage intests/generate.rs(6 tests).Follow-up
Conformance re-bless — the
protocolfixture'snotify(code: u16)is_return: None, so its golden changes.