gsm_core/
provider.rs

1use crate::Platform;
2use crate::prelude::*;
3use std::hash::{Hash, Hasher};
4
5#[derive(Clone, Debug, Eq)]
6pub struct ProviderKey {
7    pub platform: Platform,
8    pub env: EnvId,
9    pub tenant: TenantId,
10    pub team: Option<TeamId>,
11}
12
13impl PartialEq for ProviderKey {
14    fn eq(&self, other: &Self) -> bool {
15        self.platform == other.platform
16            && self.env == other.env
17            && self.tenant == other.tenant
18            && self.team == other.team
19    }
20}
21
22impl Hash for ProviderKey {
23    fn hash<H: Hasher>(&self, state: &mut H) {
24        self.platform.hash(state);
25        self.env.0.hash(state);
26        self.tenant.0.hash(state);
27        if let Some(team) = &self.team {
28            team.0.hash(state);
29        } else {
30            "".hash(state);
31        }
32    }
33}