From 4bca870f32b88ff130831d775b7dee90db40e1e4 Mon Sep 17 00:00:00 2001 From: tiye Date: Wed, 31 Jan 2024 01:20:24 +0800 Subject: [PATCH 1/2] upgrade to abi 0.0.7 ; tag 0.2.1 --- .github/workflows/check.yaml | 8 +++--- Cargo.lock | 52 +++++++++++++++++++++++++++++++++--- Cargo.toml | 4 +-- calcit.cirru | 2 +- compact.cirru | 2 +- src/lib.rs | 14 +++++----- 6 files changed, 64 insertions(+), 18 deletions(-) diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index f628c6e..8f086fc 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -16,15 +16,15 @@ jobs: - uses: supplypike/setup-bin@v3 with: - uri: 'https://github.com/calcit-lang/calcit/releases/download/0.8.0-a3/cr' + uri: 'https://github.com/calcit-lang/calcit/releases/download/0.8.21/cr' name: 'cr' - version: '0.8.0-a3' + version: '0.8.21' - uses: supplypike/setup-bin@v3 with: - uri: 'https://github.com/calcit-lang/calcit/releases/download/0.8.0-a3/caps' + uri: 'https://github.com/calcit-lang/calcit/releases/download/0.8.21/caps' name: 'caps' - version: '0.8.0-a3' + version: '0.8.21' - uses: actions-rs/toolchain@v1 with: diff --git a/Cargo.lock b/Cargo.lock index 8985370..f9b5dfb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,6 +8,25 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" +[[package]] +name = "bincode" +version = "2.0.0-rc.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f11ea1a0346b94ef188834a65c068a03aec181c94896d481d7a0a40d85b0ce95" +dependencies = [ + "bincode_derive", + "serde", +] + +[[package]] +name = "bincode_derive" +version = "2.0.0-rc.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e30759b3b99a1b802a7a3aa21c85c3ded5c28e1c83170d82d70f08bbf7f3e4c" +dependencies = [ + "virtue", +] + [[package]] name = "bitflags" version = "1.3.2" @@ -43,7 +62,7 @@ checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" [[package]] name = "calcit_wss" -version = "0.2.0-a2" +version = "0.2.1" dependencies = [ "cirru_edn", "lazy_static", @@ -58,10 +77,11 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "cirru_edn" -version = "0.4.2" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5399b8563cb708471e8ded7433bc65e725fa17e38eb339de468445c1f3ee3c70" +checksum = "8fedb67d87075cec51cc76323ebceb2e177c157ab06b4111e37849e5e15f5db7" dependencies = [ + "bincode", "cirru_parser", "hex", "lazy_static", @@ -508,6 +528,26 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +[[package]] +name = "serde" +version = "1.0.193" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.193" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.29", +] + [[package]] name = "sha1" version = "0.10.5" @@ -737,6 +777,12 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" +[[package]] +name = "virtue" +version = "0.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dcc60c0624df774c82a0ef104151231d37da4962957d691c011c852b2473314" + [[package]] name = "wasi" version = "0.10.2+wasi-snapshot-preview1" diff --git a/Cargo.toml b/Cargo.toml index 8c65d3d..76c9041 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "calcit_wss" -version = "0.2.0-a2" +version = "0.2.1" authors = ["jiyinyiyong "] edition = "2021" @@ -13,7 +13,7 @@ crate-type = ["dylib"] # Creates dynamic lib # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -cirru_edn = "0.4.2" +cirru_edn = "0.5.4" lazy_static = "1.4.0" simple-websockets = "0.1.6" diff --git a/calcit.cirru b/calcit.cirru index 346174a..5af7971 100644 --- a/calcit.cirru +++ b/calcit.cirru @@ -1,6 +1,6 @@ {} (:package |wss) - :configs $ {} (:init-fn |wss.test/main!) (:port 6001) (:reload-fn |wss.test/reload!) (:version |0.2.0-a3) + :configs $ {} (:init-fn |wss.test/main!) (:port 6001) (:reload-fn |wss.test/reload!) (:version |0.2.1) :modules $ [] :entries $ {} :files $ {} diff --git a/compact.cirru b/compact.cirru index f8864a1..bce4113 100644 --- a/compact.cirru +++ b/compact.cirru @@ -1,6 +1,6 @@ {} (:package |wss) - :configs $ {} (:init-fn |wss.test/main!) (:reload-fn |wss.test/reload!) (:version |0.2.0-a3) + :configs $ {} (:init-fn |wss.test/main!) (:reload-fn |wss.test/reload!) (:version |0.2.1) :modules $ [] :entries $ {} :files $ {} diff --git a/src/lib.rs b/src/lib.rs index ac0ae8d..ff404f0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -11,7 +11,7 @@ lazy_static! { #[no_mangle] pub fn abi_version() -> String { - String::from("0.0.6") + String::from("0.0.7") } #[no_mangle] @@ -20,7 +20,7 @@ pub fn wss_serve( handler: Arc) -> Result + Send + Sync + 'static>, _finish: Box, ) -> Result { - let port = match args.get(0) { + let port = match args.first() { Some(Edn::Map(m)) => match m.get(&Edn::tag("port")) { Some(Edn::Number(n)) => n.floor().round() as u16, Some(a) => return Err(format!("Unknown port: {}", a)), @@ -44,7 +44,7 @@ pub fn wss_serve( let mut clients = CLIENTS.write().unwrap(); clients.insert(client_id, responder); } - if let Err(e) = handler(vec![Edn::Tuple(Box::new(Edn::tag("connect")), vec![Edn::Number(client_id as f64)])]) { + if let Err(e) = handler(vec![Edn::Tuple(Arc::new(Edn::tag("connect")), vec![Edn::Number(client_id as f64)])]) { println!("Failed to handle connect: {}", e) } } @@ -55,7 +55,7 @@ pub fn wss_serve( clients.remove(&client_id); } if let Err(e) = handler(vec![Edn::Tuple( - Box::new(Edn::tag("disconnect")), + Arc::new(Edn::tag("disconnect")), vec![Edn::Number(client_id as f64)], )]) { println!("Failed to handle disconnect: {}", e) @@ -64,15 +64,15 @@ pub fn wss_serve( Event::Message(client_id, message) => match message { Message::Text(s) => { if let Err(e) = handler(vec![Edn::Tuple( - Box::new(Edn::tag("message")), - vec![Edn::Number(client_id as f64), Edn::Str(s.into_boxed_str())], + Arc::new(Edn::tag("message")), + vec![Edn::Number(client_id as f64), Edn::Str(s.into())], )]) { println!("Failed to handle text message: {}", e) } } Message::Binary(buf) => { if let Err(e) = handler(vec![Edn::Tuple( - Box::new(Edn::tag("blob")), + Arc::new(Edn::tag("blob")), vec![Edn::Number(client_id as f64), Edn::Buffer(buf)], )]) { println!("Failed to handle binary message: {}", e) From 83037fdc4a7158c6cb2013c51c64c5c3a0448833 Mon Sep 17 00:00:00 2001 From: tiye Date: Wed, 31 Jan 2024 01:40:00 +0800 Subject: [PATCH 2/2] upgrade deps of rs in CI script --- .github/workflows/check.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index 8f086fc..bfdf030 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -12,7 +12,7 @@ jobs: name: Test runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: supplypike/setup-bin@v3 with: @@ -26,9 +26,10 @@ jobs: name: 'caps' version: '0.8.21' - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@stable with: - toolchain: stable + toolchain: nightly + components: clippy - run: cargo build --release