mod private {
pub trait Sealed {}
}
pub trait WrapProtocol: private::Sealed + Default + Clone + Copy + Send + Sync + 'static {
const PROTOCOL_ID: &'static str;
}
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
pub struct Pie;
impl private::Sealed for Pie {}
impl WrapProtocol for Pie {
const PROTOCOL_ID: &'static str = "pie";
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_pie_protocol_id() {
assert_eq!(Pie::PROTOCOL_ID, "pie");
}
#[test]
fn test_pie_default() {
let pie: Pie = Pie;
assert_eq!(pie, Pie);
}
#[test]
fn test_pie_clone_copy() {
let pie = Pie;
let pie_clone = pie;
let pie_copy = pie;
assert_eq!(pie_clone, Pie);
assert_eq!(pie_copy, Pie);
}
}