1 个不稳定版本
使用旧的Rust 2015
0.1.0 | 2018年7月1日 |
---|
#912 在 编程语言
用于 resa
7KB
63 行
extractor 
实验性API,用于提取通用错误标题。
安装
在您的 Cargo.toml
中应用更改
[dependencies]
extractor = "0.1.0"
示例
error[E0382]: use of moved value: 'v'
--> examples/fail.rs:4:29
|
3 | let v2 = v;
| -- value moved here
4 | println!("v[0] is: {}\", v[0]);
| ^ value used here after move
|
= note: move occurs because `v` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait"
根据此编译器错误,通用错误标题可能是例如 use of moved value
。这个包的目的是通过外包不同的语义代码,使使用 resa 更加容易。
因为搜索 error[E0382]: use of moved value: 'v'
将导致无结果,我们需要提取这个问题的一般性。
lib.rs
:
Extractor
这是一个实验性包,用于提取使用 resa 进行错误搜索的可能内联标题。
以下示例将展示其目的
error[E0382]: use of moved value: 'v'
--> examples/fail.rs:4:29
|
3 | let v2 = v;
| -- value moved here
4 | println!("v[0] is: {}\", v[0]);
| ^ value used here after move
|
= note: move occurs because `v` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait"
一个编译器错误。Extractor包将搜索内联标题 use of moved value
。为了获取这句话,这个包需要过滤、分割和匹配正则表达式。
基于这个标题,我们可以搜索例如 StackOverflow 上的类似问题。
依赖
~2.1–3MB
~53K SLoC