Rust conventions: Difference between revisions
From wikinotes
(→Casing) |
(→Casing) |
||
Line 4: | Line 4: | ||
<blockquote> | <blockquote> | ||
<syntaxhighlight lang="rust"> | <syntaxhighlight lang="rust"> | ||
fn do_thing() { ... } // functions are | struct Foo { ... } // types, enums, structs.. are CamelCase | ||
let user_name: &str = "vaderd"; // variables are | 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