Crates.io | hc-homie5-macros |
lib.rs | hc-homie5-macros |
version | |
source | src |
created_at | 2025-02-08 19:03:48.461561+00 |
updated_at | 2025-02-08 19:06:31.883268+00 |
description | Helper crate for hc-homie5 to implement procedural macros for homie device creation. |
homepage | |
repository | https://github.com/homie-homecontrol/hc-homie5-macros |
max_upload_size | |
id | 1548311 |
Cargo.toml error: | TOML parse error at line 19, column 1 | 19 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
hc-homie5-proc
is a helper crate for hc-homie5
that provides procedural macros to simplify the creation of Homie-compliant devices in Rust.
This crate offers a procedural macro, homie_device
, which automatically adds the necessary fields and implements the HomieDeviceCore
trait for structs representing Homie devices.
You will most likely never use this create directly. It will be installed alongside hc-homie5
and reexported from there.
use hc_homie5_proc::homie_device;
use hc_homie5::{HomieDeviceCore, HomieMQTTClient};
use homie5::{
device_description::HomieDeviceDescription, Homie5DeviceProtocol, HomieDeviceStatus,
HomieDomain, HomieID, DeviceRef,
};
#[homie_device]
pub struct MyDevice {
some_field: String,
}
Applying #[homie_device]
to a struct:
device_ref: DeviceRef
status: HomieDeviceStatus
device_desc: HomieDeviceDescription
homie_proto: Homie5DeviceProtocol
homie_client: HomieMQTTClient
HomieDeviceCore
trait for the struct with default implementations for required methods.hc-homie5
for seamless MQTT-based home automation device creation.This project is licensed under the MIT License.