IntentName (src/intent.rs)

RuView · v2/crates/homecore-assist/src/intent.rs · rust · MIT
voice

Rust types for Home Assistant intents and responses, mirroring HA API.

// Source: https://github.com/ruvnet/RuView | License: MIT | Copyright 2024 rUv
// Provided via justclaw.it.com; keep this notice with the code.
//! Intent types for the HOMECORE-ASSIST pipeline.
//!
//! Mirrors `homeassistant.helpers.intent.Intent` and
//! `homeassistant.helpers.intent.IntentResponse`.

use std::collections::HashMap;

use serde::{Deserialize, Serialize};

/// Newtype wrapping the intent name string (e.g. `"HassTurnOn"`).
///
/// Kept as a newtype rather than a raw `String` so that call sites can
/// pattern-match on well-known constant values without stringly-typed bugs.
#[derive(Clone, Debug, Eq, PartialEq, Hash, Serialize, Deserialize)]
pub struct IntentName(pub String);

impl IntentName {
    pub fn new(name: impl Into<String>) -> Self {
        Self(name.into())
    }

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key