Item

See also: Reference – Items

An item is a syntax that is neither a statement nor an expression, and can appear in places where statements or expressions are illegal.

Different kinds of items

 * Functions
 * Types (structs, enums, unions, type aliases)
 * Traits
 * blocks (both inherent impls and trait impls)
 * Modules
 * Imports
 * Macros
 * Constants and static variables
 * External blocks
 * Associated items (these are only allowed in a trait,  block or   block)
 * Associated items (these are only allowed in a trait,  block or   block)

Where items can appear
Except for associated items, they can appear in any scope, including the global scope. Notably, they can appear within a function, for example:

Associated items (i.e. associated functions, types and constants) must appear in a, an   block or an   block.