800 B
800 B
MabeLabRS Style Guide
Code formatting
- Use
cargo fmtwithrustfmt.tomlin repo root. - Line width: 100.
- Always use
#[derive(Debug, Clone, PartialEq, Eq)]on simple data types.
Naming
- Crates:
mabelabrs-*prefix. - Traits:
CamelCase, noIprefix. - Structs:
CamelCase. - Enums:
CamelCasewith variantCamelCase. - Functions:
snake_case.
Error handling
- Return
Result<T, E>from fallible functions. - Use
thiserrorfor error enums. - Avoid panics, except in tests or truly unrecoverable states.
Documentation
- All public items must have
///doc comments. - Modules should have a top-level
//!doc comment.
Testing
- Unit tests inline in modules (
#[cfg(test)]). - Integration tests in
/tests. - Deterministic golden tests in
/tests/golden.