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
use proc_macro2::{Ident, Span};

use self::Side::{Client, Server};

/// Side to generate
///
/// This enum represents the two possible sides of
/// the protocol API that can be generated.
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub enum Side {
    /// wayland client applications
    Client,
    /// wayland compositors
    Server,
}

impl Side {
    pub(crate) fn object_name(self) -> Ident {
        Ident::new(
            match self {
                Client => "Proxy",
                Server => "Resource",
            },
            Span::call_site(),
        )
    }
}