Skip to content

HAP Rust SDK 文档 ​

Rust client SDK for HAP.

Setup ​

  1. Download your Rust SDK from HAP Console
  2. Extract the zip to your project directory
  3. Run cargo add --path ./hap under your project

Usage ​

rust
fn main() {
    if !hap::init("127.0.0.1", 16000, hap::ClientVersion::new(1, 0, 0, 0)) {
        panic!("init failed");
    }

    match hap::login("HAPxxxxx") {
        Ok(_) => println!("login success"),
        Err(e) => println!("login failed: {}", e),
    }

    println!("cloud_function: {:?}", hap::cloud_function("test"));
}

可联系客服了解详情。