原文:Naming - Rust API Guidelines (rust-lang.github.io)

  • snake_case:蛇形命名法,使用下划线连接小写字母
  • CamelCase:驼峰命名法,根据首字母大小写分为大小驼峰,rust里使用大驼峰
    • UpperCamelCase:第一个词的首字母,以及后面每个词的首字母都大写
    • lowerCamelCase:第一个词的首字母小写,后面每个词的首字母大写
ItemConvention
Cratesunclear
Modulessnake_case
TypesUpperCamelCase
TraitsUpperCamelCase
Enum variantsUpperCamelCase
Functionssnake_case
Methodssnake_case
General constructorsnew or with_more_details
Conversion constructorsfrom_some_other_type
Macrossnake_case!
Local variablessnake_case
StaticsSCREAMING_SNAKE_CASE
ConstantsSCREAMING_SNAKE_CASE
Type parametersconcise , usually single uppercase letter: UpperCamelCase``T
Lifetimesshort , usually a single letter: , , lowercase``'a``'de``'src
Featuresunclear but see C-FEATURE