diff options
| author | 魏曹先生 <1992414357@qq.com> | 2025-09-14 15:13:05 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2025-09-14 15:13:05 +0800 |
| commit | 1ac9ce5a7e7ad91af1ebfa990fc94857ccf6d096 (patch) | |
| tree | 4e013db9fe4956fd75d835804a42755f8e4b435f /crates/utils/tcp_connection/tcp_connection_test/src | |
| parent | 0ad594277e61e9fb41b2e470c34cff7534d6c780 (diff) | |
Add error.rs
Diffstat (limited to 'crates/utils/tcp_connection/tcp_connection_test/src')
| -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, +} |
