Skip to main content

ez_tui/types/
ship_ids.rs

1use std::fmt::Debug;
2use std::hash::Hash;
3
4/// Trait to be defined on your client's ship ids enum.
5pub trait EzShipIds: Eq + PartialEq + Clone + Hash + Debug {}
6
7/// A dummy type to be used when you don't have any ship ids
8#[derive(PartialEq, Eq, Clone, Debug, Hash)]
9pub struct NoClientShipId;
10impl EzShipIds for NoClientShipId {}
11
12/// Wrapper around the client's ship ids enum. Useless for now.
13#[allow(missing_docs)]
14#[derive(Ord, PartialOrd, PartialEq, Eq, Clone, Debug, Hash)]
15pub enum EzShipId<SID>
16where
17    SID: EzShipIds,
18{
19    Client(SID),
20}
21
22impl<SID> From<SID> for EzShipId<SID>
23where
24    SID: EzShipIds,
25{
26    fn from(cpt_id: SID) -> Self {
27        Self::Client(cpt_id)
28    }
29}