uir_core/dialects/mod.rs
1use std::fmt::{Debug, Formatter};
2
3/// Dialect name
4#[derive(Clone, Hash, PartialEq, Eq)]
5pub struct DialectName {
6 /// The name appears in many places, so use a shared type
7 name: Box<str>,
8}
9
10impl DialectName {
11 /// Create a new DialectName
12 pub fn new(name: &str) -> DialectName {
13 DialectName {
14 name: Box::from(name),
15 }
16 }
17}
18
19impl AsRef<str> for DialectName {
20 fn as_ref(&self) -> &str {
21 self.name.as_ref()
22 }
23}
24
25impl Debug for DialectName {
26 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
27 f.write_str(self.as_ref())
28 }
29}