Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

4.1.1Semicolon separator

Rust code is organized in statements separated by semicolons. In practice, each statement is written on one line and terminated with a semicolon, like in the following example in which two statements are written:

10

Since the semicolon is a separator, we may also write those two statements on a single line:

10

A statement may be divided into multiple lines, for instance to avoid excessive length:

4.1.2Curly brackets

Statements can be grouped using curly brackets:

10
15
()

Curly brackets are also used to delimit the bodies of functions:

Hello!

Or the blocks of control flows:

0 1 2 3 4 5 6 7 8 9 
()

4.1.3Naming conventions

In Rust, naming conventions (see Naming conventions) are as shown in Table 1.

Table 1:Rust naming conventions

Object

Naming style

Examples

struct, enum

PascalCase

struct YamlReader, enum CardSuit

Local variable, function

snake_case

size, nb_elements, parse_file().

Constant

CONSTANT_CASE

MAX_THREADS, TIMEOUT.