euv-core 0.49.1

Core cross-platform runtime for euv featuring arena-based fine-grained reactivity, deterministic layout, flat scene graph, multi-mode rendering, and direct OS platform adapters.
Documentation
use super::*;

/// Zero-cost type-directed property application trait for keyless `style!` declarations.
pub trait StyleApply {
    /// Mutates `style` directly in place without copying the full `Style` struct by value.
    ///
    /// # Arguments
    ///
    /// - `Self` - Strongly-typed style property value.
    /// - `&mut Style` - Mutable style accumulator modified in place.
    fn apply_in_place(self, style: &mut Style);

    /// Initializes a fresh `Style` from this strongly-typed style property or returns `self` directly when already a `Style`.
    ///
    /// # Arguments
    ///
    /// - `Self` - Strongly-typed style property value or base `Style`.
    ///
    /// # Returns
    ///
    /// - `Style` - Initialized `Style` value.
    #[must_use]
    #[inline(always)]
    fn into_base_style(self) -> Style
    where
        Self: Sized,
    {
        let mut style: Style = Style::default();
        self.apply_in_place(&mut style);
        style
    }

    /// Applies this strongly-typed style property onto `style` and returns the updated value.
    ///
    /// # Arguments
    ///
    /// - `Self` - Strongly-typed style property value.
    /// - `Style` - Target style accumulator.
    ///
    /// # Returns
    ///
    /// - `Style` - Updated style with the property applied.
    #[must_use]
    #[inline(always)]
    fn apply_to(self, mut style: Style) -> Style
    where
        Self: Sized,
    {
        self.apply_in_place(&mut style);
        style
    }
}