Code Style¶
Rust Guidelines¶
Formatting¶
Use rustfmt with default settings:
Linting¶
Use clippy:
Naming¶
| Item | Convention |
|---|---|
| Types | PascalCase |
| Functions | snake_case |
| Constants | SCREAMING_SNAKE_CASE |
Documentation¶
All public items must have doc comments:
/// Creates a new database session.
///
/// # Errors
///
/// Returns an error if the database is shutting down.
pub fn session(&self) -> Result<Session, Error> {
// ...
}
Error Handling¶
- Use
Resultfor fallible operations - Use
thiserrorfor error types - Never panic in library code
Python Guidelines¶
- Follow PEP 8
- Use type hints
- Document public APIs