a few things
cargo devel CI / cargo CI (push) Successful in 1m39s Details

This commit is contained in:
Christoph J. Scherr 2024-02-15 16:29:38 +01:00
parent bbb6ca339c
commit e270fbbdb5
Signed by: cscherrNT
GPG Key ID: 8E2B45BC51A27EA7
8 changed files with 155 additions and 0 deletions

51
Cargo.lock generated
View File

@ -176,6 +176,12 @@ version = "0.6.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1e5f035d16fc623ae5f74981db80a439803888314e3a555fd6f04acd51a3205"
[[package]]
name = "bytes"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223"
[[package]]
name = "cast"
version = "0.3.0"
@ -840,6 +846,10 @@ version = "0.4.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
[[package]]
name = "matchmatchmatch"
version = "0.1.0"
[[package]]
name = "memchr"
version = "2.7.1"
@ -861,6 +871,17 @@ dependencies = [
"adler",
]
[[package]]
name = "mio"
version = "0.8.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09"
dependencies = [
"libc",
"wasi",
"windows-sys 0.48.0",
]
[[package]]
name = "nom"
version = "7.1.3"
@ -1288,6 +1309,13 @@ dependencies = [
"digest",
]
[[package]]
name = "shortc"
version = "0.1.0"
dependencies = [
"anyhow",
]
[[package]]
name = "slab"
version = "0.4.9"
@ -1331,6 +1359,16 @@ checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c"
name = "socker"
version = "0.1.0"
[[package]]
name = "socket2"
version = "0.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9"
dependencies = [
"libc",
"windows-sys 0.48.0",
]
[[package]]
name = "strsim"
version = "0.10.0"
@ -1450,9 +1488,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104"
dependencies = [
"backtrace",
"bytes",
"libc",
"mio",
"num_cpus",
"pin-project-lite",
"socket2",
"tokio-macros",
"windows-sys 0.48.0",
]
[[package]]
@ -1466,6 +1509,14 @@ dependencies = [
"syn 2.0.48",
]
[[package]]
name = "tokio-send-sync"
version = "0.1.0"
dependencies = [
"anyhow",
"tokio",
]
[[package]]
name = "tokryon"
version = "0.0.0"

View File

@ -7,14 +7,18 @@ members = [
"members/pest-demo",
"members/revsqrt",
"members/serde-json-demo",
"members/shortc",
"members/slog-demo",
"members/socker",
"members/tokryon",
"members/tokio-send-sync",
"members/matchmatchmatch",
]
default-members = [
".",
"members/revsqrt",
"members/criterion-demo",
"members/shortc",
"members/pest-demo",
"members/serde-json-demo",
"members/slog-demo",
@ -22,8 +26,23 @@ default-members = [
"members/panic-calm",
"members/socker",
"members/tokryon",
"members/tokio-send-sync",
"members/matchmatchmatch",
]
[workspace.dependencies]
anyhow = "1.0.79"
thiserror = "1.0.56"
tokio = { version = "1.35.1", features = [
"net",
"rt",
"macros",
"rt-multi-thread",
"io-util",
"time",
"sync",
] }
[package]
name = "rs-basic"
version = "0.2.1"

View File

@ -0,0 +1,8 @@
[package]
name = "matchmatchmatch"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

View File

@ -0,0 +1,16 @@
fn main() {
let deep_type = Option::Some(Option::Some(Option::Some(())));
match deep_type {
Some(inner) => match inner {
Some(inner) => match inner {
Some(inner) => {
println!("{:?}", inner); return;
}
None => {}
},
None => {}
},
None => {}
}
unreachable!()
}

View File

@ -0,0 +1,9 @@
[package]
name = "shortc"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
anyhow = { workspace = true }

View File

@ -0,0 +1,22 @@
use anyhow::Result;
use std::{
io::{self, prelude::*},
net,
};
// This is just a very simple tcp server/client that connects to itself
const ADDR: &'static str = "127.0.0.1:9911";
fn main() -> Result<()> {
let mut listen = net::TcpListener::bind(ADDR)?;
let mut client = net::TcpStream::connect(ADDR)?;
let mut sink = io::sink();
client.write_all(b"foo")?;
let mut com = listen.accept()?;
com.0.write_all(b"bak")?;
let mut buf = [0;3];
client.read(&mut buf)?;
println!("{buf:x?}");
Ok(())
}

View File

@ -0,0 +1,10 @@
[package]
name = "tokio-send-sync"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
tokio.workspace = true
anyhow.workspace = true

View File

@ -0,0 +1,20 @@
use std::{ sync::Arc};
use tokio::{net::TcpListener, sync::Mutex};
type TestType = u64;
async fn foo(t: TestType) -> Result<TcpListener, std::io::Error> {
println!("{t}");
TcpListener::bind("127.0.0.1:50023").await
}
#[tokio::main()]
async fn main() {
let testdata: TestType = 1337;
let arcmut = Arc::new(Mutex::new(testdata));
tokio::spawn(async move {
let a = foo(testdata).await;
a.unwrap().accept().await
});
}