小编boj*_*gle的帖子

如何清除货物缓存?

当我运行时cargo build,各种库存储在文件夹中/usr/local/lib/rustlib/.

清除这些库的正确方法是什么?我可以rm手动这些文件,但这是正确的做法吗?我注意到这/usr/local/lib/rustlib/manifest是一个包含所有库的填充文件路径列表的文件,因此如果我手动删除这些文件可能会破坏某些内容.

rust rust-crates rust-cargo

17
推荐指数
2
解决办法
8695
查看次数

如何解决货物中"多包装箱"的问题?

运行时cargo build:

error: multiple matching crates for `url`
Run Code Online (Sandbox Code Playgroud)

然后列出候选人:

  • ./target/deps/liburl-11a95471847b9e04.rlib
  • /usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/liburl-4e7c5e5c.{so,rlib}

......然后中止,因为它无法决定哪一个.

src/http/lib.rs:18:1: 18:18 error: can't find crate for `url`
src/http/lib.rs:18 extern crate url;
                   ^~~~~~~~~~~~~~~~~
error: aborting due to 2 previous errors
Run Code Online (Sandbox Code Playgroud)

如何解决这个问题,或解决这个问题?


注意:

问题 和此提交 似乎与问题相关,来自评论:

+//! rust-url’s crate is also named `url`.
+//! Cargo will automatically resolve the name conflict,
+//! but that means that you can not also use the old `url` in the same crate.
Run Code Online (Sandbox Code Playgroud)

安装细节:

$ rustc -v
rustc 0.12.0-pre-nightly (7a25cf3f3 …
Run Code Online (Sandbox Code Playgroud)

rust rust-crates rust-cargo

10
推荐指数
1
解决办法
2681
查看次数

什么生锈编译器"错误:无法捕获fn项目中的动态环境;使用|| {...}闭包形式代替"意思,以及如何修复它?

我得到一个生锈编译错误:

src/main.rs:33:31: 33:35 error: can't capture dynamic environment in a fn item; use the || { ... } closure form instead
Run Code Online (Sandbox Code Playgroud)

发生错误是因为我有一个函数,我在其中声明一个变量使用let,然后有一个内部函数,我尝试使用这个被关闭的变量.

我相当肯定这是一个初学者的问题,如果这有一个非常直截了当的答案,请提前抱歉!

请注意,我正在使用此内部函数作为回调,因此使用闭包,如

let closure_fn = | args | -> () { do stuff };
Run Code Online (Sandbox Code Playgroud)

......对我来说不是一个合适的解决方案.


extern crate nickel;

use std::io::net::ip::Ipv4Addr;
use nickel::{ Nickel, Request, Response };

fn stub_3rd_party_function() -> String {
    "hello world".to_string()
}

fn main() {

    let mut server = Nickel::new();

    // assume that the variable **must** be instantiated like this
    let hello_text : String …
Run Code Online (Sandbox Code Playgroud)

syntax rust

7
推荐指数
1
解决办法
2064
查看次数

标签 统计

rust ×3

rust-cargo ×2

rust-crates ×2

syntax ×1