Naming Variables in Rust

Naming Variables in Rust

Here is a table that you follow the naming variables in Rust.

ItemConvention
CratesNot Clear(https://github.com/rust-lang/api-guidelines/issues/29)
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 UpperCamelCase, usually single uppercase letter: T
Lifetimesshort lowercase, usually a single letter: ‘a, ‘de, ‘src
Featureshttps://github.com/rust-lang/api-guidelines/issues/101 but see https://rust-lang.github.io/api-guidelines/naming.html#c-feature

Wed Aug 09 2023 11:37:22 GMT+0000 (Coordinated Universal Time)