macro_rules! op_tuple_struct_string {
(
$(#[$outer:meta])*
$name:ident
) => {
$(#[$outer])*
#[derive(Debug, Clone, Eq, PartialEq, Hash, Serialize, Deserialize)]
pub struct $name (String);
impl $name {
pub fn new(value: &str) -> $name {
$name(value.to_string())
}
pub fn get(&self) -> &str {
&self.0
}
}
impl ::std::fmt::Display for $name {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.write_str(&self.0)
}
}
};
}
macro_rules! op_tuple_struct_copy {
(
$(#[$outer:meta])*
$name:ident($T:ty)
) => {
$(#[$outer])*
#[derive(Debug, Clone, Eq, PartialEq, Hash, Serialize, Deserialize)]
pub struct $name ($T);
impl $name {
pub fn new(value: $T) -> $name {
$name(value)
}
pub fn get(&self) -> $T {
self.0
}
}
impl ::std::fmt::Display for $name {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
write!(f, "{}", self.0)
}
}
};
}