a few things
cargo devel CI / cargo CI (push) Successful in 1m39s
Details
cargo devel CI / cargo CI (push) Successful in 1m39s
Details
This commit is contained in:
parent
bbb6ca339c
commit
e270fbbdb5
|
@ -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"
|
||||
|
|
19
Cargo.toml
19
Cargo.toml
|
@ -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"
|
||||
|
|
|
@ -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]
|
|
@ -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!()
|
||||
}
|
|
@ -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 }
|
|
@ -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(())
|
||||
}
|
|
@ -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
|
|
@ -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
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue