masonry_core 0.5.0

Traits and types of the Masonry toolkit.
Documentation
// Copyright 2026 the Xilem Authors and the Druid Authors
// SPDX-License-Identifier: Apache-2.0

use crate::core::WidgetId;

use std::fmt::Display;

pub(crate) enum TimerData {
    WidgetTimer(WidgetId, TimerKey),
    TooltipHover(WidgetId),
}

/// Identifies a timer within a widget.
///
/// Each widget can have one pending timer per key. Different widgets can use
/// the same key independently.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct TimerKey(u32);

impl TimerKey {
    /// Creates a widget-local timer key.
    #[must_use]
    pub const fn new(value: u32) -> Self {
        Self(value)
    }
}

impl Display for TimerKey {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "#{}", self.0)
    }
}