From cc377acf12f2ec8bb2877664c826386357e82adb Mon Sep 17 00:00:00 2001 From: Kinflou Date: Wed, 2 Sep 2026 01:52:54 +0800 Subject: [PATCH] chore(conformance): re-bless for one-way codegen (comline-rust#4) The `protocol` fixture's `notify` (`_return: None`) is now generated fire-and-forget: no ServiceNotifyError enum, `fn notify(&self, code: u16);` on the trait, the dispatcher arm calls the handler and writes no envelope, and the client method is `-> Result<(), RuntimeError>` over Client::notify. --- conformance/Cargo.toml | 2 +- conformance/tests/golden/protocol/rust.rs | 23 ++++------------------- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/conformance/Cargo.toml b/conformance/Cargo.toml index bc38ab9..659019b 100644 --- a/conformance/Cargo.toml +++ b/conformance/Cargo.toml @@ -14,5 +14,5 @@ comline-core = { git = "https://github.com/ComlineProject/core", rev = "47ac5f10 [dev-dependencies] comline-codegen = { path = "../codegen" } -comline-codegen-rust = { git = "https://github.com/ComlineProject/comline-rust", rev = "7a9914d5aa08d74e72949df65b8c8bf5e235cc19" } +comline-codegen-rust = { git = "https://github.com/ComlineProject/comline-rust", rev = "1191e76068eca75ea7c4148d58ab127bb005e81a" } comline-codegen-typescript = { git = "https://github.com/ComlineProject/comline-typescript", rev = "86fc4eb586529ef92041f8dd3c46ff9340103411" } diff --git a/conformance/tests/golden/protocol/rust.rs b/conformance/tests/golden/protocol/rust.rs index 3162b55..510a4a1 100644 --- a/conformance/tests/golden/protocol/rust.rs +++ b/conformance/tests/golden/protocol/rust.rs @@ -29,10 +29,6 @@ pub enum ServiceLookupError { pub enum ServiceCountError { } -#[derive(Debug, Clone, PartialEq)] -pub enum ServiceNotifyError { -} - #[derive(Debug, Clone, PartialEq)] pub enum ServiceError { NotFound(NotFound), @@ -49,7 +45,7 @@ impl From for ServiceError { pub trait Service { fn lookup(&self, id: i32) -> Result; fn count(&self) -> Result; - fn notify(&self, code: u16) -> Result<(), ServiceNotifyError>; + fn notify(&self, code: u16); } pub const SERVICE_CALLS: &[&str] = &["lookup", "count", "notify"]; @@ -95,14 +91,7 @@ impl Dispatch for ServiceDispatcher { } 2 => { let p: ServiceNotifyParams = fmt.decode(params)?; - match self.0.notify(p.code) { - Ok(reply) => { - let mut body = Vec::new(); - fmt.encode(&reply, &mut body)?; - Envelope::encode_ok(&body, out); - } - Err(never) => match never {}, - } + self.0.notify(p.code); Ok(()) } _ => Err(RuntimeError::UnknownCall), @@ -137,12 +126,8 @@ impl ServiceClient { } } - pub fn notify(&mut self, code: u16) -> Result<(), CallError> { - let (reply, fmt) = self.0.call(2u16, &ServiceNotifyParams { code })?; - match reply { - Envelope::Ok(payload) => fmt.decode(payload).map_err(CallError::Runtime), - Envelope::Err { id, .. } => Err(CallError::Runtime(RuntimeError::Remote { id })), - } + pub fn notify(&mut self, code: u16) -> Result<(), RuntimeError> { + self.0.notify(2u16, &ServiceNotifyParams { code }) } }