From 993d2a9fd34ce08760933a013e638108827f6f70 Mon Sep 17 00:00:00 2001 From: diogo464 Date: Sun, 14 Dec 2025 14:49:02 +0000 Subject: Improve documentation and replace publish_on_command with CommandPolicy enum MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Enhanced crate-level documentation with comprehensive examples and feature list - Improved README with badges, better structure, and clearer examples - Added README.tpl template and generate-readme.sh script for cargo-readme - Documented run() and connect_and_run() functions with detailed behavior explanations - Replaced publish_on_command boolean with CommandPolicy enum (PublishState/Manual) - Added comprehensive documentation for CommandPolicy explaining both modes 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- src/entity_switch.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/entity_switch.rs') diff --git a/src/entity_switch.rs b/src/entity_switch.rs index 299d299..c1531eb 100644 --- a/src/entity_switch.rs +++ b/src/entity_switch.rs @@ -1,5 +1,6 @@ use crate::{ - BinaryState, Entity, EntityCommonConfig, EntityConfig, SwitchCommand, SwitchState, constants, + BinaryState, CommandPolicy, Entity, EntityCommonConfig, EntityConfig, SwitchCommand, + SwitchState, constants, }; #[derive(Debug, Default, Clone, Copy, PartialEq, Eq)] @@ -10,11 +11,14 @@ pub enum SwitchClass { Switch, } +/// Configuration for a switch entity. +/// +/// See [`CommandPolicy`] for details on how commands are handled. #[derive(Debug)] pub struct SwitchConfig { pub common: EntityCommonConfig, pub class: SwitchClass, - pub publish_on_command: bool, + pub command_policy: CommandPolicy, } impl Default for SwitchConfig { @@ -22,7 +26,7 @@ impl Default for SwitchConfig { Self { common: Default::default(), class: Default::default(), - publish_on_command: true, + command_policy: CommandPolicy::default(), } } } -- cgit