From b2a520017100ddb0119e8de41d6a079b1740cf26 Mon Sep 17 00:00:00 2001 From: Roman Volosatovs Date: Thu, 1 Sep 2022 11:10:58 +0200 Subject: [PATCH] feat: add `chat-rust-tokio` Signed-off-by: Roman Volosatovs --- .github/workflows/build.yml | 1 + Rust/tokio-chat/Cargo.lock | 216 ++++++++++++++++++++++++++++++++++++ Rust/tokio-chat/Cargo.toml | 8 ++ Rust/tokio-chat/Enarx.toml | 21 ++++ Rust/tokio-chat/src/main.rs | 4 + flake.nix | 15 +++ 6 files changed, 265 insertions(+) create mode 100644 Rust/tokio-chat/Cargo.lock create mode 100644 Rust/tokio-chat/Cargo.toml create mode 100644 Rust/tokio-chat/Enarx.toml create mode 100644 Rust/tokio-chat/src/main.rs diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7c3fdf24..d700659c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,6 +8,7 @@ jobs: strategy: matrix: output: + - chat-rust-tokio - cryptle-rust - echo-tcp-rust-mio - echo-tcp-rust-tokio diff --git a/Rust/tokio-chat/Cargo.lock b/Rust/tokio-chat/Cargo.lock new file mode 100644 index 00000000..6786888f --- /dev/null +++ b/Rust/tokio-chat/Cargo.lock @@ -0,0 +1,216 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "bytes" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "libc" +version = "0.2.132" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8371e4e5341c3a96db127eb2465ac681ced4c433e01dd0e938adbef26ba93ba5" + +[[package]] +name = "log" +version = "0.4.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "memchr" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" + +[[package]] +name = "mio" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf" +dependencies = [ + "libc", + "log", + "wasi", + "windows-sys", +] + +[[package]] +name = "once_cell" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "074864da206b4973b84eb91683020dbefd6a8c3f0f38e054d93954e891935e4e" + +[[package]] +name = "pin-project-lite" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" + +[[package]] +name = "proc-macro2" +version = "1.0.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a2ca2c61bc9f3d74d2886294ab7b9853abd9c1ad903a3ac7815c58989bb7bab" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "socket2" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "syn" +version = "1.0.99" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58dbef6ec655055e20b86b15a8cc6d439cca19b667537ac6a1369572d151ab13" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tokio" +version = "1.20.0" +source = "git+https://github.com/tokio-rs/tokio?rev=56be5286ee9548c483b91b7593ededcd34c5da0b#56be5286ee9548c483b91b7593ededcd34c5da0b" +dependencies = [ + "autocfg", + "bytes", + "libc", + "memchr", + "mio", + "once_cell", + "pin-project-lite", + "socket2", + "tokio-macros", + "winapi", +] + +[[package]] +name = "tokio-chat" +version = "0.1.0" +dependencies = [ + "tokio", +] + +[[package]] +name = "tokio-macros" +version = "1.8.0" +source = "git+https://github.com/tokio-rs/tokio?rev=56be5286ee9548c483b91b7593ededcd34c5da0b#56be5286ee9548c483b91b7593ededcd34c5da0b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "unicode-ident" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4f5b37a154999a8f3f98cc23a628d850e154479cd94decf3414696e12e31aaf" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-sys" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" +dependencies = [ + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" + +[[package]] +name = "windows_i686_gnu" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" + +[[package]] +name = "windows_i686_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" diff --git a/Rust/tokio-chat/Cargo.toml b/Rust/tokio-chat/Cargo.toml new file mode 100644 index 00000000..0c7c6645 --- /dev/null +++ b/Rust/tokio-chat/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "tokio-chat" +version = "0.1.0" +edition = "2021" +publish = false + +[dependencies] +tokio = { git = "https://github.com/tokio-rs/tokio", rev = "56be5286ee9548c483b91b7593ededcd34c5da0b", default-features = false, features = ["net", "rt", "macros", "io-util", "io-std"] } diff --git a/Rust/tokio-chat/Enarx.toml b/Rust/tokio-chat/Enarx.toml new file mode 100644 index 00000000..6667e443 --- /dev/null +++ b/Rust/tokio-chat/Enarx.toml @@ -0,0 +1,21 @@ +[[files]] +kind = "stdin" + +[[files]] +kind = "stdout" + +[[files]] +kind = "stderr" + +[[files]] +name = "ingest" +kind = "listen" +port = 50000 +prot = "tcp" +# +#[[files]] +#name = "peer" +#kind = "connect" +#port = 50000 +#prot = "tcp" +#host = "localhost" diff --git a/Rust/tokio-chat/src/main.rs b/Rust/tokio-chat/src/main.rs new file mode 100644 index 00000000..6cf4e0b4 --- /dev/null +++ b/Rust/tokio-chat/src/main.rs @@ -0,0 +1,4 @@ +#[tokio::main(flavor = "current_thread")] +async fn main() { + println!("test") +} diff --git a/flake.nix b/flake.nix index 048a4dca..2b874702 100644 --- a/flake.nix +++ b/flake.nix @@ -72,6 +72,19 @@ rustc = rust; }; in { + chat-rust-tokio-wasm = naersk-lib.buildPackage { + src = "${self}/Rust/tokio-chat"; + CARGO_BUILD_TARGET = "wasm32-wasi"; + }; + + chat-rust-tokio = buildEnarxPackage { + inherit (final) pkgs; + inherit (cargoPackage "${self}/Rust/tokio-chat/Cargo.toml") name version; + + wasm = "${final.chat-rust-tokio-wasm}/bin/tokio-chat.wasm"; + conf = "${self}/Rust/tokio-chat/Enarx.toml"; + }; + fibonacci-c-wasm = final.pkgsCross.wasi32.runCommandCC "fibonacci" { pname = "fibonacci"; @@ -276,6 +289,8 @@ packages = with pkgs; { inherit + chat-rust-tokio + chat-rust-tokio-wasm echo-tcp-rust-mio echo-tcp-rust-mio-wasm echo-tcp-rust-tokio