From efdfd6deb7f61df3062cae0e7243483c285a3ffd Mon Sep 17 00:00:00 2001 From: Tim Zhang Date: Wed, 25 Sep 2024 12:18:45 +0800 Subject: [PATCH] example: update to match new ttrpc-compiler Signed-off-by: Tim Zhang --- example/Cargo.toml | 4 ++++ example/protocols/mod.rs | 1 - example/server.rs | 10 ++-------- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/example/Cargo.toml b/example/Cargo.toml index 47094e6b..ca9fceab 100644 --- a/example/Cargo.toml +++ b/example/Cargo.toml @@ -51,3 +51,7 @@ path = "./async-stream-client.rs" [build-dependencies] ttrpc-codegen = { path = "../ttrpc-codegen"} + +[patch.crates-io] +ttrpc-compiler = { path = "/home/tim/project/ttrpc-rust/compiler"} + diff --git a/example/protocols/mod.rs b/example/protocols/mod.rs index d3d3a275..9ed5a35a 100644 --- a/example/protocols/mod.rs +++ b/example/protocols/mod.rs @@ -5,5 +5,4 @@ #[cfg(unix)] pub mod asynchronous; #[cfg(unix)] -pub use asynchronous as r#async; pub mod sync; diff --git a/example/server.rs b/example/server.rs index c15bf337..54d33f21 100644 --- a/example/server.rs +++ b/example/server.rs @@ -81,14 +81,8 @@ impl agent_ttrpc::AgentService for AgentService { fn main() { simple_logging::log_to_stderr(LevelFilter::Trace); - - let h = Box::new(HealthService {}) as Box; - let h = Arc::new(h); - let hservice = health_ttrpc::create_health(h); - - let a = Box::new(AgentService {}) as Box; - let a = Arc::new(a); - let aservice = agent_ttrpc::create_agent_service(a); + let hservice = health_ttrpc::create_health(Arc::new(HealthService {})); + let aservice = agent_ttrpc::create_agent_service(Arc::new(AgentService {})); utils::remove_if_sock_exist(utils::SOCK_ADDR).unwrap(); let mut server = Server::new()