xui 0.1.0

Declarative UI toolkit for Rust — an ergonomic layer over GPUI
Documentation
// SPDX-License-Identifier: MIT OR Apache-2.0

//! Re-exports procedural macros and defines utility macros for `xui`.

// Re-export all procedural macros from the `xui-proc-macros` crate.
pub use xui_proc_macros::*;

// Alias the `dsl` macro to `ui` for a more intuitive syntax when building layouts.
pub use xui_proc_macros::dsl as ui;

/// A convenience macro for reading global state from the GPUI application context.
///
/// # Examples
///
/// ```no_run
/// // Read the entire global state struct
/// let state = read_global!(cx, AppState);
///
/// // Read and extract a specific field or computed value
/// let count = read_global!(cx, AppState; state.count);
/// ```
#[macro_export]
macro_rules! read_global {
    ($cx:expr, $t:ty) => { $cx.read_global::<$t, _>(|v, _| v) };
    ($cx:expr, $t:ty; $($tt:tt)*) => { $cx.read_global::<$t, _>(|value, _| $($tt)*) };
}