The casing table

IdentifierConventionExample
Types, traits, enum variantsUpperCamelCaseHashMap, Iterator
Type parametersUpperCamelCase, usually one letterT
Modulessnake_casebtree_map
Functions, methods, local variablessnake_caseto_lowercase()
Macrossnake_casevec!
Statics and constantsSCREAMING_SNAKE_CASEPI_2
Lifetimesshort lowercase'a

The guidelines mark crate and feature names as unclear, so there's no official rule for those. The Rust compiler also warns by default when a name breaks these case rules, which is why Rust code is unusually consistent.

Acronyms are one word

In UpperCamelCase, an acronym or compound counts as a single word: Uuid, not UUID; Usize, not USize; Stdin, not StdIn. In snake_case it's simply lowercase: is_xid_start. A single-letter word may only come last in snake_case or SCREAMING_SNAKE_CASE, as in btree_map and PI_2.

Conversion prefixes: as_, to_, into_

PrefixCostExample
as_free; borrowed to borrowedstr::as_bytes()
to_expensive; may allocatestr::to_lowercase()
into_variable; takes ownershipString::into_bytes()

A wrapper type exposes its inner value with into_inner().

Getters drop the get_ prefix

A getter is named after the field: first(), with first_mut() for the mutable version. Use get only when there's one obvious thing to get, as in Cell::get.

Iterator methods

A collection offers iter() for shared references, iter_mut() for mutable references and into_iter() for owned values, and the returned types are named to match, such as IntoIter.

Converting names with Transform Case

Our snake_case, camelCase, PascalCase and CONSTANT_CASE converters treat an acronym as one word, so HTTP server error becomes HttpServerError and http_server_error. Rust also treats acronyms as one word, so the output matches the API Guidelines directly: Uuid, HttpServerError, http_server_error.

Naming conventions in other languages: Python, Java, C#, Go (Golang), Kotlin, Swift, Dart, PHP. All side by side: 20 languages compared.

Sources

Questions

Is it UUID or Uuid in Rust?
Uuid. The Rust API Guidelines treat acronyms as one word in UpperCamelCase.

Should Rust getters start with get_?
Generally no. Name the getter after the field, such as first(); use get only when there's one obvious thing to retrieve.

What case are Rust constants?
SCREAMING_SNAKE_CASE, for both const and static items.