https://github.com/sunsided/rust-guidelines
Coding guidelines for Rust, with examples
https://github.com/sunsided/rust-guidelines
coding-guidelines rust
Last synced: 4 days ago
JSON representation
Coding guidelines for Rust, with examples
- Host: GitHub
- URL: https://github.com/sunsided/rust-guidelines
- Owner: sunsided
- Created: 2025-08-01T21:11:43.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-08-01T21:56:28.000Z (10 months ago)
- Last Synced: 2025-08-01T23:37:16.252Z (10 months ago)
- Topics: coding-guidelines, rust
- Language: Rust
- Homepage:
- Size: 36.1 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Rust Coding Guidelines
> **Human-friendly and AI-compatible guidelines for building robust, maintainable, and idiomatic Rust applications**
[](https://www.rust-lang.org)
[](https://github.com/sunsided/rust-guidelines)
## ๐ฏ Purpose
This repository provides comprehensive, practical guidelines for Rust development, especially focused on **async and service-oriented applications**. Whether you're building web services, CLI tools, or distributed systems, these guidelines help you write code that is:
- โ
**Robust** โ Handle errors gracefully and avoid common pitfalls
- โ
**Maintainable** โ Clear structure and consistent patterns
- โ
**Idiomatic** โ Follow Rust community best practices
- โ
**AI-Compatible** โ Structured for both human developers and AI assistants
## ๐ Guidelines
**๐ [Read the Complete Guidelines](guidelines.md)**
The guidelines cover everything from project setup to advanced API design:
### ๐๏ธ **Project Foundation**
- Latest Rust edition usage
- Workspace management
- Configuration and secrets handling
### ๐จ **Code Organization**
- Feature-based module structure
- Dependency injection patterns
- Documentation standards
### โก **Error Handling & Safety**
- `thiserror` and specific error types
- Input validation strategies
- Compile-time safety patterns
### ๐ **Async & Runtime**
- Tokio runtime best practices
- Graceful shutdown patterns
### ๐งช **Testing & Quality**
- Unit, integration, and property-based testing
- Logging and tracing setup
### ๐ท๏ธ **Naming & API Design**
- Consistent naming conventions
- Ownership and borrowing guidelines
- Generic bounds and `where` clauses
## ๐ Quick Start
1. **Browse the guidelines**: Start with [guidelines.md](guidelines.md)
2. **Apply to your project**: Use the patterns and examples provided
3. **Contribute**: Found something missing? Open an issue or PR!
## ๐ฏ Who This Is For
- **Rust developers** building production applications
- **Teams** establishing coding standards
- **AI assistants** needing structured Rust guidance
- **Anyone** wanting to write better Rust code
## ๐ค Contributing
These guidelines are living documents that evolve with the Rust ecosystem. Contributions, suggestions, and discussions are welcome!
## ๐ License
This project is licensed under either of
- EUPL v1.2
- Apache License, Version 2.0
- MIT License
at your option.
---
**Happy coding! ๐ฆ**