gesha_rust_types/
module_name.rs

1use std::fmt::{Display, Formatter};
2
3#[derive(Clone, Debug, Hash, Eq, PartialEq)]
4pub struct ModuleName(String);
5
6impl ModuleName {
7    pub fn new<A: Into<String>>(a: A) -> Self {
8        Self(a.into())
9    }
10    pub fn append(mut self, a: &str) -> Self {
11        self.0.push_str(a);
12        self
13    }
14}
15
16impl Display for ModuleName {
17    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
18        Display::fmt(&self.0, f)
19    }
20}
21
22impl From<ModuleName> for String {
23    fn from(this: ModuleName) -> Self {
24        this.0
25    }
26}
27
28impl AsRef<str> for ModuleName {
29    fn as_ref(&self) -> &str {
30        &self.0
31    }
32}