blob: fc82decd606f903259e4656d381062b991bdd244 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
use std::fmt;
use crate::nfc;
#[derive(
Clone, Debug, Default, Eq, PartialEq, serde::Deserialize, serde::Serialize, sqlx::Type,
)]
#[serde(transparent)]
#[sqlx(transparent)]
pub struct Name(nfc::String);
impl fmt::Display for Name {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let Self(name) = self;
name.fmt(f)
}
}
impl From<String> for Name {
fn from(name: String) -> Self {
Self(name.into())
}
}
impl From<Name> for String {
fn from(name: Name) -> Self {
let Name(name) = name;
name.into()
}
}
|