yang_base/definition/builder/
handle.rs1use std::marker::PhantomData;
4
5#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
7pub struct ActionHandle(pub(super) usize);
8
9impl ActionHandle {
10 pub const fn slot(self) -> usize {
12 self.0
13 }
14}
15
16#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
18pub struct TypedActionHandle<I, O> {
19 pub(super) raw: ActionHandle,
20 pub(super) marker: PhantomData<fn(I) -> O>,
21}
22
23impl<I, O> Copy for TypedActionHandle<I, O> {}
24
25impl<I, O> Clone for TypedActionHandle<I, O> {
26 fn clone(&self) -> Self {
27 *self
28 }
29}
30
31impl<I, O> TypedActionHandle<I, O> {
32 pub const fn raw(self) -> ActionHandle {
34 self.raw
35 }
36}