相关疑难解决方法(0)

如何在Rust中使用外部包装箱?

我正在尝试使用rust-http库,我想将它作为一个小项目的基础.

我不知道如何使用我无法安装的东西rustpkg install <remote_url>.事实上,我今天发现rustpkg现在已经弃用了.

如果我git clone是库并运行适当的make命令来构建它,我该如何在其他地方使用它?即我如何实际使用extern crate http

libraries rust

16
推荐指数
2
解决办法
1万
查看次数

无法找到[build-dependencies]部分中列出的crate

我尝试用命令编译我的项目cargo build.

build.rs

extern crate csv;

use std::path::Path;
use std::fs::OpenOptions;
use std::io::BufWriter;
use std::io::Write;

#[allow(non_snake_case)]
fn processCSV(filename: &str, sourcePath: &str, enumName: &str) {
    println!("Generate rust source code from schema {}",filename);

    let mut ret: Vec<String> = Vec::new();
    let mut rdr = csv::Reader::from_file(filename).unwrap().flexible(true);
    for record in rdr.records().map(|r| r.unwrap()) {
    }
    let path = Path::new(sourcePath);
    let file = match OpenOptions::new().write(true).create(true).open(&path) {
        Ok(file) => file,
        Err(..) => panic!("Cannot create file {}",path.display()),
    };
    let mut writer = BufWriter::new(file);

    writer.write_all(b"test\n");
}

fn main() { …
Run Code Online (Sandbox Code Playgroud)

rust rust-cargo

4
推荐指数
1
解决办法
1106
查看次数

标签 统计

rust ×2

libraries ×1

rust-cargo ×1