bramble_crypto/
role.rs

1//! Bramble roles
2
3/// The role a peer plays in a protocol, either Alice or Bob.
4#[derive(Copy, Clone, Debug, PartialEq, Eq)]
5pub enum Role {
6    /// The Alice role.
7    Alice,
8    /// The Bob role.
9    Bob,
10}
11
12impl Role {
13    /// Gets the opposite role for this one.
14    pub fn opposite(&self) -> Role {
15        if *self == Self::Alice {
16            Self::Bob
17        } else {
18            Self::Alice
19        }
20    }
21}