From 022108f8687d65a855b522cc4861950d5728a291 Mon Sep 17 00:00:00 2001 From: Xynnn007 Date: Mon, 19 Aug 2024 17:09:04 +0800 Subject: [PATCH] Codegen: convert Arc> to Arc This commit changes the generated ttrpc server from Arc> to Arc. This helps the type conversion and also avoids extra runtime cost caused by double pointer. Fixes #234 Signed-off-by: Xynnn007 --- compiler/src/codegen.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/src/codegen.rs b/compiler/src/codegen.rs index 382f5ae..e3aebb6 100644 --- a/compiler/src/codegen.rs +++ b/compiler/src/codegen.rs @@ -145,7 +145,7 @@ impl<'a> MethodGen<'a> { "}", |w| { w.write_line(&format!( - "service: Arc>,", + "service: Arc,", self.service_name )); }, @@ -558,7 +558,7 @@ impl<'a> ServiceGen<'a> { fn write_sync_server_create(&self, w: &mut CodeWriter) { let method_handler_name = "::ttrpc::MethodHandler"; let s = format!( - "create_{}(service: Arc>) -> HashMap>", + "create_{}(service: Arc) -> HashMap>", to_snake_case(&self.service_name()), self.service_name(), method_handler_name, @@ -577,7 +577,7 @@ impl<'a> ServiceGen<'a> { fn write_async_server_create(&self, w: &mut CodeWriter) { let s = format!( - "create_{}(service: Arc>) -> HashMap", + "create_{}(service: Arc) -> HashMap", to_snake_case(&self.service_name()), self.service_name(), "::ttrpc::r#async::Service"