I import reqwest and the size of binary increase #864
-
I import reqwest and do nothing else. Run With reqwest
lz1998@lizhengdeMacBook-Pro ~/C/r/t/release (master)> ll (base)
total 1800
drwxr-xr-x 68 lz1998 staff 2.1K Mar 17 01:55 build
drwxr-xr-x 513 lz1998 staff 16K Mar 17 01:57 deps
drwxr-xr-x 2 lz1998 staff 64B Mar 17 01:31 examples
drwxr-xr-x 2 lz1998 staff 64B Mar 17 01:31 incremental
-rwxr-xr-x 1 lz1998 staff 892K Mar 17 01:57 rs_test
-rw-r--r-- 1 lz1998 staff 108B Mar 17 01:31 rs_test.d
Without reqwest
lz1998@lizhengdeMacBook-Pro ~/C/r/t/release (master)> ll (base)
total 1248
drwxr-xr-x 68 lz1998 staff 2.1K Mar 17 01:55 build
drwxr-xr-x 480 lz1998 staff 15K Mar 17 01:56 deps
drwxr-xr-x 2 lz1998 staff 64B Mar 17 01:31 examples
drwxr-xr-x 2 lz1998 staff 64B Mar 17 01:31 incremental
-rwxr-xr-x 1 lz1998 staff 618K Mar 17 01:56 rs_test
-rw-r--r-- 1 lz1998 staff 108B Mar 17 01:31 rs_test.d main.rs use axum::{response::Html, routing::get, Router};
use std::net::SocketAddr;
#[tokio::main]
async fn main() {
// build our application with a route
let app = Router::new().route("/", get(handler));
// run it
let addr = SocketAddr::from(([127, 0, 0, 1], 3000));
println!("listening on {}", addr);
axum::Server::bind(&addr)
.serve(app.into_make_service())
.await
.unwrap();
}
async fn handler() -> Html<&'static str> {
Html("<h1>Hello, World!</h1>")
} Cargo.toml [package]
name = "rs_test"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
axum = "0.4"
tokio = { version = "1.0", features = ["full"] }
# reqwest = "0.11"
[profile.release]
opt-level = 'z'
debug = false
lto = true
incremental = false
codegen-units = 1
strip = true |
Beta Was this translation helpful? Give feedback.
Answered by
davidpdrsn
Mar 16, 2022
Replies: 1 comment 4 replies
-
Excuse me but what does this have to do with axum? |
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
davidpdrsn
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Excuse me but what does this have to do with axum?