diff --git a/Cargo-minimal.lock b/Cargo-minimal.lock index 7731279e..835e598c 100644 --- a/Cargo-minimal.lock +++ b/Cargo-minimal.lock @@ -186,12 +186,6 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" -[[package]] -name = "bytes" -version = "1.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" - [[package]] name = "bzip2" version = "0.4.4" @@ -381,12 +375,6 @@ version = "0.32.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" -[[package]] -name = "hermit-abi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" - [[package]] name = "hex-conservative" version = "0.2.1" @@ -503,18 +491,6 @@ dependencies = [ "adler2", ] -[[package]] -name = "mio" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" -dependencies = [ - "hermit-abi", - "libc", - "wasi", - "windows-sys 0.52.0", -] - [[package]] name = "num-traits" version = "0.2.19" @@ -778,16 +754,6 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" -[[package]] -name = "socket2" -version = "0.5.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c970269d99b64e60ec3bd6ad27270092a5394c4e309314b18ae3fe575695fbe8" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - [[package]] name = "socks" version = "0.3.4" @@ -859,24 +825,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2209a14885b74764cce87ffa777ffa1b8ce81a3f3166c6f886b83337fe7e077f" dependencies = [ "backtrace", - "bytes", - "libc", - "mio", "pin-project-lite", - "socket2", - "tokio-macros", - "windows-sys 0.52.0", -] - -[[package]] -name = "tokio-macros" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" -dependencies = [ - "proc-macro2", - "quote", - "syn", ] [[package]] diff --git a/Cargo-recent.lock b/Cargo-recent.lock index 984a5cd3..0eb54056 100644 --- a/Cargo-recent.lock +++ b/Cargo-recent.lock @@ -186,12 +186,6 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" -[[package]] -name = "bytes" -version = "1.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" - [[package]] name = "bzip2" version = "0.4.4" @@ -789,16 +783,6 @@ version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589" -[[package]] -name = "socket2" -version = "0.5.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c970269d99b64e60ec3bd6ad27270092a5394c4e309314b18ae3fe575695fbe8" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - [[package]] name = "socks" version = "0.3.4" @@ -870,26 +854,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0cc3a2344dafbe23a245241fe8b09735b521110d30fcefbbd5feb1797ca35d17" dependencies = [ "backtrace", - "bytes", "io-uring", "libc", "mio", "pin-project-lite", "slab", - "socket2", - "tokio-macros", - "windows-sys 0.52.0", -] - -[[package]] -name = "tokio-macros" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" -dependencies = [ - "proc-macro2", - "quote", - "syn", ] [[package]] diff --git a/bitreq/Cargo.toml b/bitreq/Cargo.toml index 7533cac9..4f01d65d 100644 --- a/bitreq/Cargo.toml +++ b/bitreq/Cargo.toml @@ -32,7 +32,7 @@ webpki-roots = { version = "0.25.2", optional = true } rustls-webpki = { version = "0.101.0", optional = true } log = { version = "0.4.0", optional = true } # For the async feature: -tokio = { version = "1.0", features = ["net", "time", "io-util", "rt", "rt-multi-thread", "macros"], optional = true } +tokio = { version = "1.0", features = ["rt", "rt-multi-thread"], optional = true } tokio-rustls = { version = "0.24", optional = true } [dev-dependencies] diff --git a/bitreq/examples/async_hello.rs b/bitreq/examples/async_hello.rs index 705f0843..eec019b8 100644 --- a/bitreq/examples/async_hello.rs +++ b/bitreq/examples/async_hello.rs @@ -1,11 +1,16 @@ //! This example demonstrates the `async` feature. -#[tokio::main] -async fn main() -> Result<(), bitreq::Error> { - let response = bitreq::get("http://httpbin.org/get").send_async().await?; +fn main() -> Result<(), bitreq::Error> { + let runtime = tokio::runtime::Builder::new_current_thread() + .build() + .expect("failed to build Tokio runtime"); - println!("Status: {}", response.status_code); - println!("Body: {}", response.as_str()?); + runtime.block_on(async { + let response = bitreq::get("http://httpbin.org/get").send_async().await?; - Ok(()) + println!("Status: {}", response.status_code); + println!("Body: {}", response.as_str()?); + + Ok(()) + }) }