返回 Skill 列表
extension
分类: 开发与工程无需 API Key

rust-system-event-driven

Rust事件驱动系统编程的最佳实践,适用于异步运行时、通道、套接字、终端和并发。在编写、审查或重构具有异步I/O、多线程、终端接口或网络通信的Rust应用程序时应使用此技能。当任务涉及tokio、async/await、通道、套接字、TTY处理、信号以及流式I/O时触发。

person作者: jakexiaohubgithub

Rust System Event-Driven Best Practices

Comprehensive best practices guide for event-driven system programming in Rust. Contains 42 rules across 8 categories, prioritized by impact to guide async runtime usage, channel communication, threading, networking, and terminal handling.

When to Apply

Reference these guidelines when:

  • Building async applications with Tokio or async-std
  • Implementing network servers or clients
  • Writing terminal user interfaces (TUIs)
  • Managing concurrent tasks and shared state
  • Handling Unix signals and graceful shutdown

Rule Categories by Priority

| Priority | Category | Impact | Prefix | |----------|----------|--------|--------| | 1 | Async Runtime Patterns | CRITICAL | async- | | 2 | Channel Communication | CRITICAL | chan- | | 3 | Threading & Synchronization | HIGH | sync- | | 4 | Socket & Network I/O | HIGH | net- | | 5 | Terminal & TTY Handling | MEDIUM-HIGH | term- | | 6 | Signal & Process Control | MEDIUM | sig- | | 7 | File I/O Streaming | MEDIUM | io- | | 8 | Event Loop Architecture | LOW-MEDIUM | loop- |

Quick Reference

1. Async Runtime Patterns (CRITICAL)

2. Channel Communication (CRITICAL)

3. Threading & Synchronization (HIGH)

4. Socket & Network I/O (HIGH)

5. Terminal & TTY Handling (MEDIUM-HIGH)

6. Signal & Process Control (MEDIUM)

7. File I/O Streaming (MEDIUM)

8. Event Loop Architecture (LOW-MEDIUM)

How to Use

Read individual reference files for detailed explanations and code examples:

Reference Files

| File | Description | |------|-------------| | references/_sections.md | Category definitions and ordering | | assets/templates/_template.md | Template for new rules | | metadata.json | Version and reference information |