crisol-core 1.1.0

Crisol core: an egui-free data model, themes, metrics, localization, commands, state, and storage.
Documentation
//! Events emitted by a host.
//!
//! ```
//! use crisol_core::protocol::events;
//! ```

use serde::{Deserialize, Serialize};
use serde_json::Value;

/// Something the host reports to the embedding application.
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(tag = "event", rename_all = "snake_case")]
#[non_exhaustive]
/// # Example
///
/// ```
/// use crisol_core::protocol::HostEvent;
/// ```
pub enum HostEvent {
    /// A button or command ran.
    Command {
        /// Command id.
        id: String,
    },
    /// A value changed.
    ValueChanged {
        /// Widget id.
        id: String,
        /// New value.
        value: Value,
    },
    /// A tab strip changed.
    TabChanged {
        /// Strip id.
        id: String,
        /// Active index.
        index: usize,
    },
    /// A tree selection changed.
    TreeSelected {
        /// Tree id.
        id: String,
        /// Node key.
        key: String,
    },
    /// A custom widget emitted an event.
    Custom {
        /// Widget kind.
        kind: String,
        /// Opaque payload.
        payload: Value,
    },
    /// The host window was closed.
    Closed,
}