use std::borrow::Cow;
use std::fmt;
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
pub struct Subscribe<'a> {
pub name: Cow<'a, str>,
pub what: Option<usize>,
pub format: Option<usize>,
}
impl<'a> fmt::Display for Subscribe<'a> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let mut v = Vec::new();
v.push(self.name.to_string());
if let Some(what) = self.what {
v.push(what.to_string());
}
if let Some(format) = self.format {
v.push(format.to_string());
}
let s = v.join(":");
write!(f, "{}", s)
}
}