Skip to main content

engine/events/
subscription.rs

1//! Subscription handles.
2
3/// The identity of an [`EventBus`](super::event_bus::EventBus) subscription.
4#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
5pub struct SubscriptionId(usize);
6
7impl SubscriptionId {
8    pub(crate) fn new(value: usize) -> Self {
9        Self(value)
10    }
11
12    /// Returns the raw subscription counter value.
13    ///
14    /// Primarily useful for debugging and tests.
15    pub fn get(self) -> usize {
16        self.0
17    }
18}