allow
// 该属性用于隐藏对未使用代码的警告。#[allow(dead_code)]// 不显示类型转换产生的溢出警告。#[allow(overflowing_literals)]// 通过这个属性屏蔽警告。#[allow(non_camel_case_types)]type u64_t = u64;#![allow(unreachable_code)]
derive
关联:16节部分1
#[derive(PartialEq)] // 允许这种类型进行相等测试(equality test)。
自动推导的 trait:
- 比较 trait:
Eq,PartialEq,Ord,PartialOrd Clone, 用来从&T创建副本T。Copy,使类型具有 “复制语义”(copy semantics)而非 “移动语义”(move semantics)。Hash,从&T计算哈希值(hash)。Default, 创建数据类型的一个空实例。Debug,使用{:?}formatter 来格式化一个值。
feature
#![feature(never_type)]
cargo feature 具体参考小记(Note)
https://dev.to/rimutaka/cargo-features-explained-with-examples-194g
