Skip to the content.

Rust API Reference

This document provides a detailed reference for the core components of Rustuya: Device, SubDevice, and Scanner. All core types are thread-safe and designed for high-concurrency environments.

Importing the Library

Depending on the application architecture, select the appropriate import path:


1. System Optimization

maximize_fd_limit()


2. Device API

Direct interaction with individual Tuya devices.

Device::new()

Device::builder()

device.status()

device.set_value()

device.set_dps()

device.listener()

unified_listener()


3. SubDevice API

Interaction with sub-devices (endpoints) through a parent Gateway Device. Obtained via device.sub(cid).

device.sub()

sub_device.status() / set_value() / set_dps()


4. Scanner API

UDP-based device discovery on the local network.

Scanner::scan()

Scanner::scan_stream()