From 0116dbea32a0af6f9b98f290228edf360f4eeea6 Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Tue, 12 Dec 2023 22:09:28 +0800 Subject: [PATCH] Update rust_socketio path in Cargo.toml and refactor ws_main function --- ica-rs/Cargo.toml | 2 +- ica-rs/src/main.rs | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ica-rs/Cargo.toml b/ica-rs/Cargo.toml index 3cf45bc5..03b0c91c 100644 --- a/ica-rs/Cargo.toml +++ b/ica-rs/Cargo.toml @@ -13,4 +13,4 @@ rust_socketio = "0.4.4" serde_json = "1.0.108" [patch.crates-io] -rust_socketio = { path = "V:/githubs/rust-socketio/socketio" } \ No newline at end of file +rust_socketio = { path = "../../../rust-socketio/socketio" } \ No newline at end of file diff --git a/ica-rs/src/main.rs b/ica-rs/src/main.rs index 74ee1fd2..405715ba 100644 --- a/ica-rs/src/main.rs +++ b/ica-rs/src/main.rs @@ -48,9 +48,10 @@ fn ws_main() { let connect_call_back = |payload: Payload, _client: RawClient, _id| { match payload { Payload::Text(values) => { - if values.first() == Some(&Value::String("authSucceed".to_string())) { - // 一个绿色的 "已经连接到 icalingua 服务器" - println!("\x1b[32m已经登录到 icalingua!\x1b[0m"); + if let Some(value) = values.first() { + if let Some("authSucceed") = value.as_str() { + println!("\x1b[32m已经登录到 icalingua!\x1b[0m"); + } } }, _ => ()