diff options
| author | 魏曹先生 <1992414357@qq.com> | 2025-09-14 22:42:20 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2025-09-14 22:42:20 +0800 |
| commit | d79f1ffeecc7539b9f13bf1edbc3f1a9e82448b2 (patch) | |
| tree | 786eb17d441f3ea4c84960e57c66457a4ac23694 /crates/utils/tcp_connection/tcp_connection_test | |
| parent | bd923afe53de552c1f69e0db5a4490c73a294b91 (diff) | |
Fixed codes by Zed
Diffstat (limited to 'crates/utils/tcp_connection/tcp_connection_test')
| -rw-r--r-- | crates/utils/tcp_connection/tcp_connection_test/src/example_handle.rs | 20 | ||||
| -rw-r--r-- | crates/utils/tcp_connection/tcp_connection_test/src/test_tcp_target_build.rs | 2 |
2 files changed, 17 insertions, 5 deletions
diff --git a/crates/utils/tcp_connection/tcp_connection_test/src/example_handle.rs b/crates/utils/tcp_connection/tcp_connection_test/src/example_handle.rs index cefeef0..2c84bd1 100644 --- a/crates/utils/tcp_connection/tcp_connection_test/src/example_handle.rs +++ b/crates/utils/tcp_connection/tcp_connection_test/src/example_handle.rs @@ -1,14 +1,26 @@ -use tcp_connection::handle::{ClientHandle, ServerHandle}; -use tokio::net::TcpStream; +use tcp_connection::{ + handle::{ClientHandle, ServerHandle}, + instance::ConnectionInstance, +}; pub(crate) struct ExampleClientHandle; impl ClientHandle<ExampleServerHandle> for ExampleClientHandle { - fn process(stream: TcpStream) {} + fn process( + instance: ConnectionInstance, + ) -> impl std::future::Future<Output = ()> + Send + Sync { + let _ = instance; + async {} + } } pub(crate) struct ExampleServerHandle; impl ServerHandle<ExampleClientHandle> for ExampleServerHandle { - fn process(stream: TcpStream) {} + fn process( + instance: ConnectionInstance, + ) -> impl std::future::Future<Output = ()> + Send + Sync { + let _ = instance; + async {} + } } diff --git a/crates/utils/tcp_connection/tcp_connection_test/src/test_tcp_target_build.rs b/crates/utils/tcp_connection/tcp_connection_test/src/test_tcp_target_build.rs index b375671..c108e42 100644 --- a/crates/utils/tcp_connection/tcp_connection_test/src/test_tcp_target_build.rs +++ b/crates/utils/tcp_connection/tcp_connection_test/src/test_tcp_target_build.rs @@ -26,4 +26,4 @@ async fn test_tcp_test_target_build_domain() { // Test into string assert_eq!(target.to_string(), "127.0.0.1:8080"); -} default_port, +} |
