- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我把 reqwest 库弄得一团糟,并想用 Rust Playground 尝试一些示例。我已经从网络上获取了最简单的示例之一,但是它没有编译。
请点击下面的链接,然后点击运行:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=fb0e7911a018ddb927cb13debd34fff4
这是控制台中显示的编译错误:
Compiling playground v0.0.1 (/playground)
error: linking with `cc` failed: exit code: 1
|
= note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-Wl,--eh-frame-hdr" "-L" "/playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/playground/target/debug/deps/playground-552f473283bcb85e.playground.1fpw7zol-cgu.0.rcgu.o" "-o" "/playground/target/debug/deps/playground-552f473283bcb85e" "/playground/target/debug/deps/playground-552f473283bcb85e.4jwju6fs7xga1d77.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-nodefaultlibs" "-L" "/playground/target/debug/deps" "-L" "/playground/target/debug/build/libsqlite3-sys-16200be2df74876c/out" "-L" "/playground/target/debug/build/ring-bb20fb99fa6aa7fb/out" "-L" "/playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/playground/target/debug/deps/libfutures-e81e955c63e30b74.rlib" "/playground/target/debug/deps/libfutures_executor-cfdeba081d488308.rlib" "/playground/target/debug/deps/libreqwest-f9a05f7baf6db60c.rlib" "/playground/target/debug/deps/libcookie_store-140640047f1ead84.rlib" "/playground/target/debug/deps/libpublicsuffix-6ec6805d8d4576ca.rlib" "/playground/target/debug/deps/libregex-690a57b3d88f2f3e.rlib" "/playground/target/debug/deps/libthread_local-8d339f961a8cde82.rlib" "/playground/target/debug/deps/libregex_syntax-4b763771453cb6c9.rlib" "/playground/target/debug/deps/libaho_corasick-a90058961ca40ce7.rlib" "/playground/target/debug/deps/liberror_chain-bfc8e31e68aab259.rlib" "/playground/target/debug/deps/libbacktrace-1f6305b7986130af.rlib" "/playground/target/debug/deps/libobject-8fae803afce7a82f.rlib" "/playground/target/debug/deps/libaddr2line-4cb58e132c263024.rlib" "/playground/target/debug/deps/libobject-600bcc9a4024c890.rlib" "/playground/target/debug/deps/libflate2-7c0dda569caa75f2.rlib" "/playground/target/debug/deps/libminiz_oxide-06fcba964606bf52.rlib" "/playground/target/debug/deps/libadler-cf7f582a580fb2a1.rlib" "/playground/target/debug/deps/libcrc32fast-d8f8d6d441eb6dc8.rlib" "/playground/target/debug/deps/libwasmparser-18775bada4336335.rlib" "/playground/target/debug/deps/libgimli-e397da103aee7023.rlib" "/playground/target/debug/deps/libstable_deref_trait-33402efe82680c8b.rlib" "/playground/target/debug/deps/libfallible_iterator-2abec6be3aaf9504.rlib" "/playground/target/debug/deps/libcpp_demangle-af0e508f637e754e.rlib" "/playground/target/debug/deps/librustc_demangle-b0887c2590d815fd.rlib" "/playground/target/debug/deps/libcookie-212b7aa8adce5158.rlib" "/playground/target/debug/deps/libtime-fd9f56ac09845820.rlib" "/playground/target/debug/deps/libtime_macros-a8c33e90ea2139d7.rlib" "/playground/target/debug/deps/libstandback-f34bd7ec31cc9868.rlib" "/playground/target/debug/deps/libhyper_tls-9848d4b1ee8e7a27.rlib" "/playground/target/debug/deps/libipnet-8e33934d86be4d6e.rlib" "/playground/target/debug/deps/libtokio_native_tls-095fa4f445b9ada7.rlib" "/playground/target/debug/deps/libserde_urlencoded-c61505e8efe59184.rlib" "/playground/target/debug/deps/libencoding_rs-6db646af6aed58d2.rlib" "/playground/target/debug/deps/libserde_json-aaaea4d5f17e7bfd.rlib" "/playground/target/debug/deps/libryu-8177541eadb28761.rlib" "/playground/target/debug/deps/libbase64-263cbd5a5e64ab1a.rlib" "/playground/target/debug/deps/libmime_guess-eb8a1cb9893e4e18.rlib" "/playground/target/debug/deps/libunicase-b4234293fa194e2e.rlib" "/playground/target/debug/deps/libmime-f1104dec2de465c5.rlib" "/playground/target/debug/deps/libnative_tls-7028e32d0e94add2.rlib" "/playground/target/debug/deps/libopenssl_probe-7372e2218175cb8d.rlib" "/playground/target/debug/deps/libopenssl-84d1cdf5218f0b74.rlib" "/playground/target/debug/deps/libopenssl_sys-2038d81ad68cd2ed.rlib" "/playground/target/debug/deps/libforeign_types-37adb5bae539fda7.rlib" "/playground/target/debug/deps/libforeign_types_shared-22f2940fb592036b.rlib" "/playground/target/debug/deps/libbitflags-23cf02f711efe05e.rlib" "/playground/target/debug/deps/libhyper-430dd2c2e9afb7dd.rlib" "/playground/target/debug/deps/libwant-de668461c77b0f6d.rlib" "/playground/target/debug/deps/libtry_lock-30c95cee42568441.rlib" "/playground/target/debug/deps/libhttparse-ebba17a8d7f5b2dd.rlib" "/playground/target/debug/deps/libsocket2-abd46160d6c6c84a.rlib" "/playground/target/debug/deps/libh2-67e8c1f896ffcf25.rlib" "/playground/target/debug/deps/libtracing_futures-bfe252ef9bfa1357.rlib" "/playground/target/debug/deps/libindexmap-e59d655bbe32a039.rlib" "/playground/target/debug/deps/libhashbrown-89e2fd5a7081dfb3.rlib" "/playground/target/debug/deps/libahash-842a5b5404407a6a.rlib" "/playground/target/debug/deps/libconst_random-2c7202c77a6d1341.rlib" "/playground/target/debug/deps/libtokio_util-c597572dfab0a5a3.rlib" "/playground/target/debug/deps/libtower_service-25325533e6471f27.rlib" "/playground/target/debug/deps/libpin_project-85290df7927f46fd.rlib" "/playground/target/debug/deps/libhttpdate-7c9ae15df7de953a.rlib" "/playground/target/debug/deps/libtracing-1e9a893c023cc151.rlib" "/playground/target/debug/deps/libtracing_core-f4d747dfd45a5b1b.rlib" "/playground/target/debug/deps/libtokio-6caecbf8c961c6fc.rlib" "/playground/target/debug/deps/libsignal_hook_registry-464320536f92cd1a.rlib" "/playground/target/debug/deps/libnum_cpus-fa9405d418802dba.rlib" "/playground/target/debug/deps/libmio-8208b1b97ee75dd0.rlib" "/playground/target/debug/deps/libparking_lot-c70fd5290b63ba21.rlib" "/playground/target/debug/deps/libparking_lot_core-bec2d0cef1e036dd.rlib" "/playground/target/debug/deps/libsmallvec-be204749242d57d5.rlib" "/playground/target/debug/deps/liblock_api-9b94798a31b72387.rlib" "/playground/target/debug/deps/libscopeguard-9a7fcdcc3ef0c67a.rlib" "/playground/target/debug/deps/libinstant-801a426885a9fdfa.rlib" "/playground/target/debug/deps/libhttp_body-fa23070edd81973e.rlib" "/playground/target/debug/deps/libfutures_util-b297dd64f98a2e4a.rlib" "/playground/target/debug/deps/libmemchr-49ffcb39de512148.rlib" "/playground/target/debug/deps/libtokio_io-15767d74b5cad8b6.rlib" "/playground/target/debug/deps/libbytes-98612ff3704441d9.rlib" "/playground/target/debug/deps/libiovec-059f69bab14804ea.rlib" "/playground/target/debug/deps/liblibc-0a0510b4037c39f2.rlib" "/playground/target/debug/deps/libbyteorder-630514d63ec14067.rlib" "/playground/target/debug/deps/liblog-1181c8ecdf8fff43.rlib" "/playground/target/debug/deps/libcfg_if-ef24fecc97daf057.rlib" "/playground/target/debug/deps/libfutures-341be2426ac8006a.rlib" "/playground/target/debug/deps/libfutures_io-f642e5411fe1b621.rlib" "/playground/target/debug/deps/libslab-fae38ccb0866d90f.rlib" "/playground/target/debug/deps/libfutures_channel-ca57d40e72b73391.rlib" "/playground/target/debug/deps/libpin_project_lite-3a1c1edfcac5da66.rlib" "/playground/target/debug/deps/libfutures_sink-1e577cd08304b39b.rlib" "/playground/target/debug/deps/libfutures_task-285aea8d738140d9.rlib" "/playground/target/debug/deps/libonce_cell-49c2029294b89ee5.rlib" "/playground/target/debug/deps/libpin_utils-9d73d18d1a913b9e.rlib" "/playground/target/debug/deps/libfutures_core-3c03d3ccebe39c3b.rlib" "/playground/target/debug/deps/liblazy_static-a2d7352f0b2d8328.rlib" "/playground/target/debug/deps/liburl-3738c4378d8afb19.rlib" "/playground/target/debug/deps/libidna-44ceb179b4e434c3.rlib" "/playground/target/debug/deps/libunicode_normalization-7b85e62e0830fcdd.rlib" "/playground/target/debug/deps/libtinyvec-0fd102c28a026123.rlib" "/playground/target/debug/deps/libtinyvec_macros-373a732416c546b7.rlib" "/playground/target/debug/deps/libserde-f598327513f0f87c.rlib" "/playground/target/debug/deps/libunicode_bidi-a18e706d77b75aca.rlib" "/playground/target/debug/deps/libform_urlencoded-4539bb7bd3b31a2c.rlib" "/playground/target/debug/deps/libpercent_encoding-6c71419d296d9169.rlib" "/playground/target/debug/deps/libmatches-396398bf8ad55ae0.rlib" "/playground/target/debug/deps/libhttp-bc59be26651c0476.rlib" "/playground/target/debug/deps/libitoa-97b61b74c453bfb8.rlib" "/playground/target/debug/deps/libbytes-196811ca1432aaea.rlib" "/playground/target/debug/deps/libfnv-f0ba3a8dcbb1e827.rlib" "-Wl,--start-group" "/playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-6f77337c1826707d.rlib" "/playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-e238540f8faf9927.rlib" "/playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-78f8506dd5004913.rlib" "/playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-c0e64497deb085aa.rlib" "/playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-217a514dc8d845c6.rlib" "/playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-65e4f8df4b8bbd73.rlib" "/playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-fec1b74170245419.rlib" "/playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-e74f867eb2f15322.rlib" "/playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-72a374d36f3d0a31.rlib" "/playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-cb9206ed96de54c3.rlib" "/playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-33ee81149d314805.rlib" "/playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-2e8740599b11634b.rlib" "/playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-241cf59851357bea.rlib" "/playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-edc29aa8c04b480f.rlib" "/playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-6a141406945fda5a.rlib" "/playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-2408224b4af46d83.rlib" "-Wl,--end-group" "/playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-d36087076e1dd756.rlib" "-Wl,-Bdynamic" "-lssl" "-lcrypto" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc"
= note: collect2: fatal error: ld terminated with signal 9 [Killed]
compilation terminated.
error: aborting due to previous error
error: could not compile `playground`
To learn more, run the command again with --verbose.
D:\DANI\rust\projects\httpget>cargo run Compiling httpget v0.1.0 (D:\DANI\rust\projects\httpget)
Finished dev [unoptimized + debuginfo] target(s) in 2.80s
Running `target\debug\httpget.exe` Request: https://httpbin.org/ip thread 'main' panicked at 'not currently running on a Tokio 0.2.x runtime.', C:\Users\dani\.cargo\registry\src\github.com-1ecc6299db9ec823\tokio-0.2.25\src\runtime\handle.rs:118:28 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace error: process didn't exit successfully: `target\debug\httpget.exe` (exit code: 101)
我检查了Cargo.toml中的依赖项:
[dependencies]
error-chain = "0.12.4"
reqwest = { version = "0.10" }
tokio = { version = "1", features = ["full"] }
futures = "0.3"
我认为它与async/await运行时有关,但是我是Rust语言的新手,我在网络上发现的有关此问题的信息对我来说还不清楚。
最佳答案
这是reqwest版本的问题。将您的原始版本替换为
reqwest = { version = "0.11" }
在Cargo.toml中应将其修复在本地计算机上。
关于rust - Rust Playground和本地计算机中reqwest示例的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66409193/
编辑备注 由于 Rust(版本:1.42)仍然没有稳定的 ABI ,推荐使用extern (目前相当于extern "C"(将来可能会改变))否则,可能需要重新编译库。 This article解释如
词法分析器/解析器文件位于 here非常大,我不确定它是否适合只检索 Rust 函数列表。也许我自己编写/使用另一个库是更好的选择? 最终目标是创建一种执行管理器。为了上下文化,它将能够读取包装在函数
我试图在 Rust 中展平 Enum 的向量,但我遇到了一些问题: enum Foo { A(i32), B(i32, i32), } fn main() { let vf =
我正在 64 位模式下运行的 Raspberry Pi 3 上使用 Rust 进行裸机编程。我已经实现了一个自旋锁,如下所示: use core::{sync::atomic::{AtomicBool
我无法理解以下示例是如何从 this code 中提炼出来的, 编译: trait A: B {} trait B {} impl B for T where T: A {} struct Foo;
在我写了一些代码和阅读了一些文章之后,我对 Rust 中的移动语义有点困惑,我认为值移动后,它应该被释放,内存应该是无效的。所以我尝试写一些代码来作证。 第一个例子 #[derive(Debug)]
https://doc.rust-lang.org/reference/types/closure.html#capture-modes struct SetVec { set: HashSe
考虑 const-generic 数据结构的经典示例:方矩阵。 struct Matrix { inner: [[T; N]; N] } 我想返回一个结构体,其 const 参数是动态定义的:
以下代码无法编译,因为 x在移动之后使用(因为 x 具有类型 &mut u8 ,它没有实现 Copy 特性) fn main() { let mut a: u8 = 1; let x:
我在玩 Rust,发现了下面的例子: fn main() { let mut x = [3, 4, 5].to_vec(); x; println!("{:?}", x); }
假设一个 Rust 2018 宏定义了一个 async里面的功能。它将使用的语法与 Rust 2015 不兼容。因此,如果您使用 2015 版编译您的 crate,那么宏中的扩展代码不会与它冲突吗?
假设我有一些 Foo 的自定义集合s: struct Bar {} struct Foo { bar: Bar } struct SubList { contents: Vec, }
代码如下: fn inner(x:&'a i32, _y:&'b i32) -> &'b i32 { x } fn main() { let a = 1; { let b
在lifetime_things的定义中,'b的生命周期比'a长,但实际上当我调用这个函数时,x1比y1长,但是这样可以编译成功: //here you could see 'b:'a means
我正在尝试检索 FLTK-RS Widget 周围的 Arc Mutex 包装器的内部值: pub struct ArcWidget(Arc>); impl ArcWidget{ pub
如下代码所示,我想封装一个定时函数,返回一个闭包的结果和执行时间。 use tap::prelude::Pipe; use std::time::{Instant, Duration}; pub fn
我想实现自己的通用容器,这是我正在使用的特征的片段: pub trait MyVec where Self: Default + Clone + IntoIterator, Self:
所需代码: 注释掉的块可以编译并工作,但是我想从嵌套的匹配样式转变为更简洁的函数链 async fn ws_req_resp(msg: String, conn: PgConn) -> Result>
我正在尝试编写一些代码,该代码将生成具有随机值的随机结构。对于结构,我具有以下特征和帮助程序宏: use rand::{thread_rng, Rng}; use std::fmt; pub trai
我有一个带有函数成员的结构: struct Foo { fun: Box, } type FooI = Foo; 这不起作用: error[E0106]: missing lifetime s
我是一名优秀的程序员,十分优秀!