use serde::{Deserialize, Serialize};
pub const OPEN_RING_NAME: &str = "open";
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct RingId(pub String);
impl RingId {
pub fn open() -> Self {
RingId(OPEN_RING_NAME.to_owned())
}
pub fn as_str(&self) -> &str {
&self.0
}
pub fn is_open(&self) -> bool {
self.0 == OPEN_RING_NAME
}
}
impl std::fmt::Display for RingId {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.0)
}
}