strid_examples/
minimal.rs1use strid::braid;
5
6#[braid(serde)]
9pub struct MinimalUsernameBuf(MinimalString);
10
11#[derive(
14 Clone,
15 Debug,
16 Hash,
17 PartialEq,
18 Eq,
19 PartialOrd,
20 Ord,
21 serde::Serialize,
22 serde::Deserialize,
23 facet::Facet,
24)]
25#[facet(transparent)]
26pub struct MinimalString(String);
27
28impl From<String> for MinimalString {
29 fn from(s: String) -> Self {
30 MinimalString(s)
31 }
32}
33
34impl From<&'_ str> for MinimalString {
35 fn from(s: &str) -> Self {
36 MinimalString(s.into())
37 }
38}
39
40impl From<Box<str>> for MinimalString {
41 fn from(s: Box<str>) -> Self {
42 MinimalString(s.into())
43 }
44}
45
46impl AsRef<str> for MinimalString {
47 fn as_ref(&self) -> &str {
48 self.0.as_ref()
49 }
50}
51
52impl From<MinimalString> for String {
53 fn from(s: MinimalString) -> Self {
54 s.0
55 }
56}