use std::str::FromStr;
use crate::StdError;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct MithrilNetwork(String);
impl MithrilNetwork {
pub fn new(name: String) -> Self {
Self(name)
}
pub fn dummy() -> Self {
Self("dummy".to_string())
}
pub fn name(&self) -> &str {
&self.0
}
}
impl From<String> for MithrilNetwork {
fn from(name: String) -> Self {
MithrilNetwork::new(name)
}
}
impl From<&str> for MithrilNetwork {
fn from(name: &str) -> Self {
MithrilNetwork::new(name.to_string())
}
}
impl FromStr for MithrilNetwork {
type Err = StdError;
fn from_str(s: &str) -> Result<Self, Self::Err> {
Ok(MithrilNetwork::new(s.to_string()))
}
}