use std::borrow::Cow;
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct ProviderId(pub Cow<'static, str>);
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum ProviderKind {
PublicOracle,
LocalNode,
DigPeers,
Custom,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ProviderInfo {
pub id: ProviderId,
pub kind: ProviderKind,
pub priority: i32,
pub trustless: bool,
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn provider_info_carries_its_descriptor() {
let info = ProviderInfo {
id: ProviderId(Cow::Borrowed("coinset.org")),
kind: ProviderKind::PublicOracle,
priority: 10,
trustless: false,
};
assert_eq!(info.id, ProviderId(Cow::Borrowed("coinset.org")));
assert_eq!(info.kind, ProviderKind::PublicOracle);
assert_eq!(info.priority, 10);
assert!(!info.trustless);
}
}