Rust conventions: Difference between revisions
From wikinotes
(→Naming) |
(→Casing) |
||
(One intermediate revision by the same user not shown) | |||
Line 4: | Line 4: | ||
<blockquote> | <blockquote> | ||
<syntaxhighlight lang="rust"> | <syntaxhighlight lang="rust"> | ||
fn do_thing() { ... } // | struct Foo { ... } // types, enums, structs.. are CamelCase | ||
mod math_things { ... } // modules are snake_case | |||
fn do_thing() { ... } // functions are snake_case | |||
let user_name: &str = "vaderd"; // variables are snake_case | |||
</syntaxhighlight> | </syntaxhighlight> | ||
</blockquote><!-- Casing --> | </blockquote><!-- Casing --> |
Latest revision as of 15:33, 8 February 2023
Naming
Casing
struct Foo { ... } // types, enums, structs.. are CamelCase mod math_things { ... } // modules are snake_case fn do_thing() { ... } // functions are snake_case let user_name: &str = "vaderd"; // variables are snake_case
Spacing
4x spaces