Skip to main content

bullet_exchange_interface/
string.rs

1#[cfg(feature = "schema")]
2use sov_universal_wallet::schema::{IndexLinking, Item, Link, Primitive, Schema, UniversalWallet};
3
4use crate::define_simple_type;
5
6define_simple_type!(CustomString(String) + Debug);
7
8#[cfg(feature = "schema")]
9impl UniversalWallet for CustomString {
10    fn scaffold() -> Item<IndexLinking> {
11        Item::Atom(Primitive::String)
12    }
13    fn get_child_links(_schema: &mut Schema) -> Vec<Link> {
14        Vec::new()
15    }
16}
17
18impl CustomString {
19    pub fn as_str(&self) -> &str {
20        &self.0
21    }
22}
23
24impl From<String> for CustomString {
25    fn from(v: String) -> Self {
26        Self(v)
27    }
28}
29impl From<&str> for CustomString {
30    fn from(v: &str) -> Self {
31        Self(v.to_string())
32    }
33}
34
35impl std::fmt::Display for CustomString {
36    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
37        write!(f, "{}", self.0)
38    }
39}