extern crate reqwest;
fn main() {
let client = reqwest::Client::new();
}
当我运行它时,我得到了这个错误。
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', libcore/option.rs:345:21
我也尝试过使用构建器,但错误仍然相同。
extern crate reqwest;
fn main() {
let mut client = reqwest::Client::builder(); // Panics here
match client.build() {
Err(e) => {println!("{:?}", e);}
_ => {}
}
}
这是此代码的完整堆栈回溯。
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', libcore/option.rs:345:21
stack backtrace:
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
1: std::sys_common::backtrace::print
at libstd/sys_common/backtrace.rs:71
at libstd/sys_common/backtrace.rs:59
2: std::panicking::default_hook::{{closure}}
at libstd/panicking.rs:211
3: std::panicking::default_hook
at libstd/panicking.rs:227
4: std::panicking::rust_panic_with_hook
at libstd/panicking.rs:511
5: std::panicking::continue_panic_fmt
at libstd/panicking.rs:426
6: rust_begin_unwind
at libstd/panicking.rs:337
7: core::panicking::panic_fmt
at libcore/panicking.rs:92
8: core::panicking::panic
at libcore/panicking.rs:53
9: <core::option::Option<T>>::unwrap
at /checkout/src/libcore/macros.rs:20
10: openssl::ssl::SslContextBuilder::set_options
at /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-0.9.24/src/ssl/mod.rs:905
11: openssl::ssl::connector::ctx
at /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-0.9.24/src/ssl/connector.rs:42
12: openssl::ssl::connector::SslConnectorBuilder::new
at /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-0.9.24/src/ssl/connector.rs:67
13: native_tls::imp::TlsConnector::builder
at /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/native-tls-0.1.5/src/imp/openssl.rs:186
14: native_tls::TlsConnector::builder
at /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/native-tls-0.1.5/src/lib.rs:390
15: reqwest::async_impl::client::ClientBuilder::new
at /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/reqwest-0.8.6/src/async_impl/client.rs:79
16: reqwest::client::ClientBuilder::new
at /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/reqwest-0.8.6/src/client.rs:63
17: reqwest::client::Client::builder
at /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/reqwest-0.8.6/src/client.rs:281
18: project::proj::tp_app::uploader::start
at src/proj/tp_app/uploader.rs:4