为什么 Rust 整数类型很快就会被弃用?

Ale*_*vik 7 integer standard-library deprecated rust

我注意到Rust std 页面u8上的、i8等旁边有一条弃用注释u16

在此输入图像描述

发生了什么事,替代品会是什么?

lko*_*bly 15

类型本身并没有被弃用,只是名为egstd::i8的包含常量的模块被弃用。例如,std::i8::MIN被替换为i8::MIN( docs )。弃用通知中写道:

Deprecating in a future Rust version: all constants in this module replaced by associated constants on i8
Run Code Online (Sandbox Code Playgroud)

  • 可能值得一提的是,被弃用的确切内容是名为“std::i8”的_modules_等,其中包含这些常量。 (2认同)