Rust conventions: Difference between revisions
From wikinotes
(Created page with "= Naming = <blockquote> </blockquote><!-- Naming --> = Spacing = <blockquote> <syntaxhighlight lang="yaml"> 4x spaces </syntaxhighlight> </blockquote><!-- Spacing -->") |
(→Casing) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
= Naming = | = Naming = | ||
<blockquote> | <blockquote> | ||
== Casing == | |||
<blockquote> | |||
<syntaxhighlight lang="rust"> | |||
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> | |||
</blockquote><!-- Casing --> | |||
</blockquote><!-- Naming --> | </blockquote><!-- Naming --> | ||
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