【rust编译错误解读】

PANIC

1cannot index into a value of type std::option::Option<&Vec<Value>>
(不能访问下标index在一个Option包裹的Vec中)
尝试对一个 Option 类型的值进行索引操作,而这个 Option 可能包含一个对 Vec 的引用,或者它可能是 None。在 Rust 中,你不能直接对 Option 类型的值进行索引,因为它不是序列类型(像 Vec 或数组那样)。你需要先从 Option 中提取出 Vec 的引用,然后才能对它进行索引。

2 mismatched types
expected struct Vec<(f64, f64)>
found struct std::iter::Map<std::option::Iter<'_, &Vec<Value>>, {closure@src\main.rs:242:62: 242:67}>

3 mismatched types
expected struct dashmap::mapref::multiple::RefMulti<'_, std::string::String, data>
found tuple (_, _)rustcClick for full compiler diagnostic
main.rs(263, 28): this is an iterator with items of type dashmap::mapref::multiple::RefMulti<'_, std::string::String, data>

derive may only be applied to structs, enums and unions
错误信息 “derive may only be applied to structs, enums and unions” 表明你尝试在一个不是结构体(struct)、枚举(enum)或联合(union)的项上使用 derive 属性宏。在 Rust 中,derive 属性用于自动派生一些特性(traits)的实现,如 Debug、PartialEq 等,但它只能用于特定的类型。

WARN

variable BTC_subscription should have a snake case name
#[warn(non_snake_case)] on by defaultrustcClick for full compiler diagnostic
main.rs(103, 10): convert the identifier to snake case: btc_subscription

在 Rust 中,有一个编码规范建议变量名应该使用蛇形命名法(snake_case)。这意味着变量名应该全部由小写字母组成,单词之间使用下划线(_)分隔。这个规范在 Rust 的默认设置 #[warn(non_snake_case)] 中是开启的,所以如果你的变量名不符合这个规范,编译器会发出警告。

根据你提供的错误信息,你需要将变量名 BTC_subscription 转换为蛇形命名法。你可以将其重命名为 btc_subscription

相关推荐

  1. rust编译错误解读

    2024-04-21 02:10:02       17 阅读
  2. Rust 实战练习 - 9. 文本编码,URL编码,加密解密

    2024-04-21 02:10:02       11 阅读
  3. Rust】——panic!和不可恢复的错误

    2024-04-21 02:10:02       21 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-04-21 02:10:02       16 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-04-21 02:10:02       16 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-04-21 02:10:02       15 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-04-21 02:10:02       18 阅读

热门阅读

  1. 【无标题】

    2024-04-21 02:10:02       10 阅读
  2. P2483 【模板】k 短路 / [SDOI2010] 魔法猪学院

    2024-04-21 02:10:02       15 阅读
  3. npm run build 自动生成dist.zip

    2024-04-21 02:10:02       15 阅读
  4. linux xfrm框架详细介绍

    2024-04-21 02:10:02       17 阅读
  5. [CLS] 输出向量 和 [MASK] 向量

    2024-04-21 02:10:02       13 阅读
  6. TCP协议复习

    2024-04-21 02:10:02       14 阅读
  7. SpringBoot将上传的文件保存到临时文件

    2024-04-21 02:10:02       13 阅读
  8. C语言经典例题-19

    2024-04-21 02:10:02       14 阅读
  9. 视频怎么去水印,轻松去视频水印的方法

    2024-04-21 02:10:02       13 阅读
  10. 服务器为什么要定期备份

    2024-04-21 02:10:02       15 阅读
  11. Linux at练习之在系统中设定延迟任务

    2024-04-21 02:10:02       13 阅读