Code Codex
Defines a naming convention for variables, functions, structs, enums, and debug strings in a Rust codebase.
What this file does
Defines a naming convention for variables, functions, structs, enums, and debug strings in a Rust codebase.
When to use it
- You want consistent naming across a Rust project
- You need to distinguish input, output, and internal variables
- You are working on a large codebase with many modules
- You want to standardize debug string formatting
Assumes this stack
Code Codex
A standardized guideline for names in Manufacture
Variables
Input Variables
Naming for any data you want the function to have
Syntax: IN_[naMe]
e.g.
fn render_util_world(&mut self, IN_gameData: &mut SYS_DATA)
pub fn DATA_cacheData_ADD(&mut self, IN_dataIndex: &str, IN_data: CACHE_TYPE)
Output Variables
Naming for any data that will be returned but requires intialization first, such as Lists or Vectors
Syntax: OUT_[naMe]
e.g.
let mut OUT_genTiles: Vec<(usize, usize)> = Vec::new();
...
return OUT_genTiles;
Variables inside function
Naming for variables inside the function to not confuse them with global variables
Syntax: w_[naMe]
e.g.
let mut w_iterCoords: system::coords = IN_pos;
let w_cellCoords = IN_pos[0] + IN_pos[1] * system::SYS_REND_BUFFER_X;
Constant variables
Naming for system constants or other important variables
System Variables
Syntax: [CATE_GORY]_[SUB_CATEGORY]_[NA_ME]
e.g.
pub const SYS_TICKRATE_BASE: u8 = 8;
Important variables
Syntax: [CATEGORY]_[naMe]
e.g.
let TIMER_renderTime = Instant::now()
Temporary values
Primarily to stop compiler from whining
Syntax: idkfa_[naMe]
let mut idkfa_playerPos = DATA_LOCK.DATA_player.p_pos
Common variable names
Common names for reocurring variables
Following this is advised
Position: IN_pos | w_[...]Pos | OUT_pos
System data: &mut IN_sysData
Indexing for Hashmaps: IN_dataIndex
Timers for speed check: TIMER_[...]Time | loopStart
Functions
Public Functions
Naming for functions that will be used outside the struct/module
Syntax: [CATEGORY]_[naMe]
e.g.
pub fn MAIN_renderGame(&mut self)
Private Functions
Naming for functions that will be used internally by struct/module only
Syntax: [cateGory]_[subCategory]_[naMe]
e.g.
fn render_util_text(&mut self)
Function Groups
Naming for groups of functions that do similar operations
Syntax: [CATEgoRy]_[groUp]_[TYPE]
e.g.
pub fn DATA_cacheData_GET(&self, IN_dataIndex: &str)
Structs
Struct Naming
Naming for structs
Syntax: [TYPE]_[naMe]
e.g.
pub struct Data_dataMaster
Struct Fields
Naming for struct fields
Syntax: [CATEGORY]_[naMe]
e.g.
pub DATA_debug: HashMap<String, DATA_debugItem>,
Struct Functions
Naming for struct functions
Same rules as those in Functions section
Additionally, if the struct is specialized in one thing only (i.e. Renderer, Logic), it must have a MAIN_ function to start their process
Enums
Naming for enums
Syntax: [TYPE]_[naMe]
e.g.
pub enum DATA_cacheType
Debug Strings
Naming for strings that will be used for debug
Syntax: .DEBUG_[cateGory]/#[CATEGORY]_[naMe]
e.g.
".DEBUG_sys":{
"#SYS_dataContainerInit": "Data Container initialized",
Misc
Naming for miscellaneous things
Global values lock
Syntax: [NAME]_LOCK
let mut DATA_LOCK = data.lock().unwrap()
Uncategorized stuff
Syntax: IDDQD_[naMe]
pub struct IDDQD_textItem
What's inside
7 sections covering variables, functions, structs, enums, debug strings, and misc with 15+ naming rules and examples
Change this for your project
- Replace
Manufacturein the title with your project name - Replace
SYS_DATAwith your system data type - Replace
DATA_cacheData_ADDwith your own function names
Where it goes
Reference documentation for a retrieval pipeline. Keep with the ingestion or retrieval code it describes.
Worth borrowing
- Prefixing variables with
IN_,OUT_,w_to indicate their role - Using
idkfa_andIDDQD_prefixes for temporary or uncategorized items
Related Documents
SUMMARY
Proposes three on-prem AI architectures, modular, hybrid, and fully local RAG, with hardware specs and vendor lists.
Retrieval & Prompts
Explains how CharMemory's extraction prompt and Vector Storage settings determine memory retrieval quality in SillyTavern.
Advanced RAG Techniques
Surveys advanced RAG architectures, Agentic, Corrective, Self-RAG, Graph RAG, RAPTOR, Multimodal, Temporal, with design trade-offs and decision guidance.
RFC-BLite: High-Performance Embedded Document Database for .NET
Specifies an embedded document database for.NET with zero-allocation I/O, C-BSON format, and ACID transactions.