1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
mod impl_fmt;

#[cfg(feature = "serde")]
mod serde;

#[cfg(test)]
mod tests;

/// Identifier of an actor.
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct ActorID(Inner);

impl ActorID {
    /// Create a new [`ActorID`] from the provided components
    pub(crate) fn new(system: usize, actor: usize, seq: usize) -> Self {
        Self(Inner { system, actor, seq })
    }
    /// Get `system` component
    pub(crate) fn system(&self) -> usize {
        self.0.system
    }
    /// Get `actor` component
    pub(crate) fn actor(&self) -> usize {
        self.0.actor
    }
    /// Get `seq` component
    pub(crate) fn seq(&self) -> usize {
        self.0.seq
    }
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
struct Inner {
    system: usize,
    actor: usize,
    seq: usize,
}