Использование привязок. Вставьте это в свой Cargo.toml
:
[dependencies.curl]
git = "https://github.com/carllerche/curl-rust"
... и это в src/main.rs
:
extern crate curl;
use curl::http;
fn main(){
let resp = http::handle()
.post("http://localhost:3000/login", "username=dude&password=sikrit")
.exec().unwrap();
println!("code={}; headers={}; body={}",
resp.get_code(), resp.get_headers(), resp.get_body());
}