The Rust Book makes several references to the word "item", which confers the word a technical meaning in the context of the Rust programming language. For example, see Chapter 07-03:
The way privacy works in Rust is that all items (functions, methods, structs, enums, modules, and constants) are private by default. Items in a parent module can’t use the private items inside child modules, but items in child modules can use the items in their ancestor modules.
What is an item and is there a comprehensive list of all the kinds that there are in Rust?
Items - Rust Reference:
An item is a component of a crate. [...] There are several kinds of items:
- Modules
extern crate
declarationsuse
declarations- Function definitions
- Type definitions
- Struct definitions
- Enumeration definitions
- Union definitions
- Constant items
- Static items
- Trait definitions
- Implementations
extern
blocks
An item is simply any declaration that could appear globally in a program or module, such as a fn, struct, or use.
Reference: Programming Rust: Fast, Safe Systems Development (2nd Edition)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With