Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
7eb9369c3This file is pinned to the selected release. Download the original to open it in your design tool.
use std::fmt::{Display, Formatter};
use std::str::FromStr;
use thiserror::Error;
#[derive(Debug, serde::Serialize, serde::Deserialize, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Reference(String);
impl FromStr for Reference {
type Err = ReferenceError;
fn from_str(s: &str) -> Result<Self, Self::Err> {
Ok(Reference(s.to_string()))
}
}
impl Display for Reference {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
f.write_str(self.0.as_str())
}
}
#[derive(Debug, Error)]
#[error("Reference error")]
pub struct ReferenceError;