feat: usable?
This commit is contained in:
@@ -1,13 +1,24 @@
|
||||
use std::fmt::{Display, Formatter, Result as FmtResult};
|
||||
use std::ops::Deref;
|
||||
|
||||
use ecow::EcoString;
|
||||
use derive_more::Constructor;
|
||||
use ecow::EcoString;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Constructor)]
|
||||
pub struct Catchable {
|
||||
msg: Option<String>,
|
||||
}
|
||||
|
||||
impl Display for Catchable {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
|
||||
if let Some(ref msg) = self.msg {
|
||||
write!(f, "<error: {msg}>")
|
||||
} else {
|
||||
write!(f, "<error>")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Hash, PartialEq, Eq, PartialOrd, Ord, Constructor)]
|
||||
pub struct Symbol(EcoString);
|
||||
|
||||
@@ -17,6 +28,12 @@ impl<T: Into<EcoString>> From<T> for Symbol {
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for Symbol {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
|
||||
write!(f, r#"Sym({})"#, self.0)
|
||||
}
|
||||
}
|
||||
|
||||
impl Deref for Symbol {
|
||||
type Target = str;
|
||||
fn deref(&self) -> &Self::Target {
|
||||
|
||||
Reference in New Issue
Block a user