Skip to the content.

Architecture

Rustuya is designed with a layered architecture that separates network concerns, protocol logic, and user-facing APIs. This separation ensures high performance, reliability, and ease of maintenance.


Layer Overview

  1. User API Layer: Provides high-level interfaces for Rust and Python.
  2. Sync Wrapper Layer: Bridges the asynchronous core to synchronous APIs for ease of use in simple scripts.
  3. Core Logic Layer: Manages device lifecycle, connection pooling, and event dispatching.
  4. Protocol Layer: Handles Tuya-specific message framing, encryption, and decryption.
  5. Transport Layer: Manages low-level TCP/UDP communication using tokio.

Component Breakdown


For maintainer-facing notes on how each component actually behaves at runtime — lifecycles, channels, timers, backoff math, the unified-listener model, and the small decisions that the layer overview glosses over — see Technical Notes.