From 4d02fea51951f4a7d50f06c2b49d8cd577f0f304 Mon Sep 17 00:00:00 2001 From: tiye Date: Wed, 15 May 2024 01:55:30 +0800 Subject: [PATCH 1/3] upgrade calcit deps; tag 0.0.6 --- .github/workflows/check.yaml | 14 +++---------- Cargo.lock | 39 +++++++++++++++++++++++++++++++----- Cargo.toml | 6 +++--- src/lib.rs | 30 ++++++++++++++++----------- 4 files changed, 58 insertions(+), 31 deletions(-) diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index 447d5f6..13553ab 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -12,19 +12,11 @@ jobs: name: Test runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - uses: supplypike/setup-bin@v3 + - uses: calcit-lang/setup-cr@0.0.3 with: - uri: "https://github.com/calcit-lang/calcit/releases/download/0.8.0/cr" - name: "cr" - version: "0.8.0" - - - uses: supplypike/setup-bin@v3 - with: - uri: "https://github.com/calcit-lang/calcit/releases/download/0.8.0/caps" - name: "caps" - version: "0.8.0" + version: "0.8.50" - uses: dtolnay/rust-toolchain@stable with: diff --git a/Cargo.lock b/Cargo.lock index a380c73..903fd11 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14,6 +14,25 @@ version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" +[[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" @@ -34,7 +53,7 @@ checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" [[package]] name = "calcit_http" -version = "0.0.5" +version = "0.0.6" dependencies = [ "cirru_edn", "cirru_parser", @@ -55,10 +74,11 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "cirru_edn" -version = "0.5.0" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a35d38ee59f7409023f9dee361dc98760f33c9ad1f21283e536939d9561ed44" +checksum = "b4e435d0f66a1d16f727720f46a89c7a203e306bf466483ba5ff65903fd0f05c" dependencies = [ + "bincode", "cirru_parser", "hex", "lazy_static", @@ -66,9 +86,12 @@ dependencies = [ [[package]] name = "cirru_parser" -version = "0.1.25" +version = "0.1.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1297388204c9d3c72d1cafea80682fd6384e79c66dfe980460886bff7387e684" +checksum = "c96247e15778d471f8c94b321fa11220dfb987546fcf8fb73b1a5c2b3a018a78" +dependencies = [ + "bincode", +] [[package]] name = "core-foundation" @@ -840,6 +863,12 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" +[[package]] +name = "virtue" +version = "0.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dcc60c0624df774c82a0ef104151231d37da4962957d691c011c852b2473314" + [[package]] name = "want" version = "0.3.0" diff --git a/Cargo.toml b/Cargo.toml index 4719e60..07ebf01 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "calcit_http" -version = "0.0.5" +version = "0.0.6" authors = ["jiyinyiyong "] edition = "2021" @@ -13,6 +13,6 @@ 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.5.0" -cirru_parser = "0.1.25" +cirru_edn = "0.6.3" +cirru_parser = "0.1.29" reqwest = { version = "0.11.20", features = ["blocking"] } diff --git a/src/lib.rs b/src/lib.rs index 0477dea..0ac62ce 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,4 @@ -use cirru_edn::Edn; +use cirru_edn::{Edn, EdnTupleView}; use reqwest::{ header::{HeaderMap, HeaderName, HeaderValue}, Method, @@ -7,10 +7,16 @@ use std::sync::Arc; use std::thread::spawn; pub fn wrap_ok(x: Edn) -> Edn { - Edn::Tuple(Box::new(Edn::tag("ok")), vec![x]) + Edn::Tuple(EdnTupleView { + tag: Arc::new(Edn::tag("ok")), + extra: vec![x], + }) } pub fn wrap_err(x: Edn) -> Edn { - Edn::Tuple(Box::new(Edn::tag("err")), vec![x]) + Edn::Tuple(EdnTupleView { + tag: Arc::new(Edn::tag("err")), + extra: vec![x], + }) } struct RequestSkeleton { @@ -22,7 +28,7 @@ struct RequestSkeleton { #[no_mangle] pub fn abi_version() -> String { - String::from("0.0.6") + String::from("0.0.7") } #[no_mangle] @@ -47,11 +53,11 @@ pub fn fetch( a => return Err(format!("unexpected method: {}", a)), }; - let b = builder.body(options.body).headers(options.headers).query(&options.query); + let b = builder.body(options.body).headers(options.headers).query(&*options.query); let ret = match b.send() { Ok(res) => match res.text() { - Ok(s) => handler(vec![wrap_ok(Edn::Str(s.to_string().into_boxed_str()))]), + Ok(s) => handler(vec![wrap_ok(Edn::Str(s.into()))]), Err(e) => handler(vec![wrap_err(Edn::str(format!("failed to turn body into text: {}", e)))]), }, Err(e) => return Err(format!("fetch failed: {}", e)), @@ -80,7 +86,7 @@ fn parse_request_options(info: &Edn) -> Result { match info { Edn::Map(m) => { req.method = match m.get(&Edn::tag("method")) { - Some(Edn::Tag(k)) => k.to_str().parse::().map_err(|x| x.to_string())?, + Some(Edn::Tag(k)) => k.ref_str().parse::().map_err(|x| x.to_string())?, None => Method::GET, Some(a) => return Err(format!("invalid method name: {}", a)), }; @@ -91,7 +97,7 @@ fn parse_request_options(info: &Edn) -> Result { }; match m.get(&Edn::tag("headers")) { Some(Edn::Map(xs)) => { - for (k, v) in xs { + for (k, v) in &xs.0 { match (k, v) { (Edn::Str(k2), Edn::Str(v2)) => { req @@ -101,7 +107,7 @@ fn parse_request_options(info: &Edn) -> Result { (Edn::Tag(k2), Edn::Str(v2)) => { req .headers - .insert(k2.to_str().parse::().unwrap(), v2.parse::().unwrap()); + .insert(k2.ref_str().parse::().unwrap(), v2.parse::().unwrap()); } _ => return Err(format!("expected strings for headers: {}, {}", k, v)), } @@ -118,14 +124,14 @@ fn parse_request_options(info: &Edn) -> Result { for x in xs { if let Edn::List(ys) = x { if ys.len() == 2 { - match (&ys[0], &ys[1]) { + match (&ys.0[0], &ys.0[1]) { (Edn::Str(k), Edn::Str(v)) => { - req.query.push((k.to_owned(), v.to_owned())); + req.query.push((Box::from(&**k), Box::from(&**v))); // quit jump to next call continue; } (Edn::Tag(k), Edn::Str(v)) => { - req.query.push((k.to_str().to_owned(), v.to_owned())); + req.query.push((k.ref_str().into(), Box::from(&**v))); // quit jump to next call continue; } From df6d5f87faa5a943d588b31ec615363c8c1c2f31 Mon Sep 17 00:00:00 2001 From: tiye Date: Sun, 19 May 2024 11:44:58 +0800 Subject: [PATCH 2/3] update ABI 0.0.7 --- .github/workflows/check.yaml | 2 +- Cargo.lock | 6 +++--- Cargo.toml | 4 ++-- calcit.cirru | 2 +- compact.cirru | 2 +- src/lib.rs | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index 13553ab..13eefe3 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -16,7 +16,7 @@ jobs: - uses: calcit-lang/setup-cr@0.0.3 with: - version: "0.8.50" + version: "0.8.51" - uses: dtolnay/rust-toolchain@stable with: diff --git a/Cargo.lock b/Cargo.lock index 903fd11..6f14daf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -53,7 +53,7 @@ checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" [[package]] name = "calcit_http" -version = "0.0.6" +version = "0.0.7" dependencies = [ "cirru_edn", "cirru_parser", @@ -74,9 +74,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "cirru_edn" -version = "0.6.3" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4e435d0f66a1d16f727720f46a89c7a203e306bf466483ba5ff65903fd0f05c" +checksum = "cf2af443516dfa62939fbfe82812601c1cb5fc89fdf7356eee519d7b056a264d" dependencies = [ "bincode", "cirru_parser", diff --git a/Cargo.toml b/Cargo.toml index 07ebf01..fa0c222 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "calcit_http" -version = "0.0.6" +version = "0.0.7" authors = ["jiyinyiyong "] edition = "2021" @@ -13,6 +13,6 @@ 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.6.3" +cirru_edn = "0.6.5" cirru_parser = "0.1.29" reqwest = { version = "0.11.20", features = ["blocking"] } diff --git a/calcit.cirru b/calcit.cirru index 424dcae..d34fd20 100644 --- a/calcit.cirru +++ b/calcit.cirru @@ -1,6 +1,6 @@ {} (:package |fetch) - :configs $ {} (:init-fn |fetch.test/main!) (:port 6001) (:reload-fn |fetch.test/reload!) (:version |0.0.5) + :configs $ {} (:init-fn |fetch.test/main!) (:port 6001) (:reload-fn |fetch.test/reload!) (:version |0.0.7) :modules $ [] :entries $ {} :files $ {} diff --git a/compact.cirru b/compact.cirru index 988744d..1ff1edf 100644 --- a/compact.cirru +++ b/compact.cirru @@ -1,6 +1,6 @@ {} (:package |fetch) - :configs $ {} (:init-fn |fetch.test/main!) (:reload-fn |fetch.test/reload!) (:version |0.0.5) + :configs $ {} (:init-fn |fetch.test/main!) (:reload-fn |fetch.test/reload!) (:version |0.0.7) :modules $ [] :entries $ {} :files $ {} diff --git a/src/lib.rs b/src/lib.rs index 0ac62ce..d6dd06a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -28,7 +28,7 @@ struct RequestSkeleton { #[no_mangle] pub fn abi_version() -> String { - String::from("0.0.7") + String::from("0.0.8") } #[no_mangle] From 21b9fe57d164a704f2e6e780325cc71434b59771 Mon Sep 17 00:00:00 2001 From: tiye Date: Mon, 20 May 2024 01:55:15 +0800 Subject: [PATCH 3/3] ABI 0.0.9 ; tag 0.0.8 --- .github/workflows/check.yaml | 2 +- Cargo.lock | 6 +++--- Cargo.toml | 4 ++-- calcit.cirru | 2 +- compact.cirru | 2 +- src/lib.rs | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index 13eefe3..8b1befe 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -16,7 +16,7 @@ jobs: - uses: calcit-lang/setup-cr@0.0.3 with: - version: "0.8.51" + version: "0.8.52" - uses: dtolnay/rust-toolchain@stable with: diff --git a/Cargo.lock b/Cargo.lock index 6f14daf..8d837de 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -53,7 +53,7 @@ checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" [[package]] name = "calcit_http" -version = "0.0.7" +version = "0.0.8" dependencies = [ "cirru_edn", "cirru_parser", @@ -74,9 +74,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "cirru_edn" -version = "0.6.5" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf2af443516dfa62939fbfe82812601c1cb5fc89fdf7356eee519d7b056a264d" +checksum = "b4aa8a3c939e1480883ea1371deab36c179e621779f9a7731554b9bec3840189" dependencies = [ "bincode", "cirru_parser", diff --git a/Cargo.toml b/Cargo.toml index fa0c222..9e8e653 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "calcit_http" -version = "0.0.7" +version = "0.0.8" authors = ["jiyinyiyong "] edition = "2021" @@ -13,6 +13,6 @@ 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.6.5" +cirru_edn = "0.6.8" cirru_parser = "0.1.29" reqwest = { version = "0.11.20", features = ["blocking"] } diff --git a/calcit.cirru b/calcit.cirru index d34fd20..62cd1a1 100644 --- a/calcit.cirru +++ b/calcit.cirru @@ -1,6 +1,6 @@ {} (:package |fetch) - :configs $ {} (:init-fn |fetch.test/main!) (:port 6001) (:reload-fn |fetch.test/reload!) (:version |0.0.7) + :configs $ {} (:init-fn |fetch.test/main!) (:port 6001) (:reload-fn |fetch.test/reload!) (:version |0.0.8) :modules $ [] :entries $ {} :files $ {} diff --git a/compact.cirru b/compact.cirru index 1ff1edf..df54c9f 100644 --- a/compact.cirru +++ b/compact.cirru @@ -1,6 +1,6 @@ {} (:package |fetch) - :configs $ {} (:init-fn |fetch.test/main!) (:reload-fn |fetch.test/reload!) (:version |0.0.7) + :configs $ {} (:init-fn |fetch.test/main!) (:reload-fn |fetch.test/reload!) (:version |0.0.8) :modules $ [] :entries $ {} :files $ {} diff --git a/src/lib.rs b/src/lib.rs index d6dd06a..e2ec326 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -28,7 +28,7 @@ struct RequestSkeleton { #[no_mangle] pub fn abi_version() -> String { - String::from("0.0.8") + String::from("0.0.9") } #[no_mangle]