cranium_core/
identifiers.rs1use core::borrow::Borrow;
16
17use bevy::prelude::*;
18use bevy::reflect::{Reflect};
19
20#[cfg(any(feature = "actionset_loader"))]
21use serde::{Serialize, Deserialize};
22
23
24#[derive(Reflect, Clone, Debug, Hash, PartialEq, Eq)]
25#[cfg_attr(any(feature = "actionset_loader"), derive(Serialize, Deserialize))]
26#[cfg_attr(any(feature = "actionset_loader"), serde(transparent))]
27pub struct ContextFetcherIdentifier(pub String);
28
29impl ContextFetcherIdentifier {
30 pub fn from_string(value: String) -> Self {
31 Self(value)
32 }
33}
34
35impl<IS: Into<String>> From<IS> for ContextFetcherIdentifier {
36 fn from(value: IS) -> Self {
37 Self::from_string(value.into())
38 }
39}
40
41impl Borrow<str> for ContextFetcherIdentifier {
42 fn borrow(&self) -> &str {
43 self.0.borrow()
44 }
45}
46
47impl Borrow<str> for &ContextFetcherIdentifier {
48 fn borrow(&self) -> &str {
49 self.0.borrow()
50 }
51}
52
53impl Borrow<String> for ContextFetcherIdentifier {
54 fn borrow(&self) -> &String {
55 self.0.borrow()
56 }
57}
58
59impl Borrow<String> for &ContextFetcherIdentifier {
60 fn borrow(&self) -> &String {
61 self.0.borrow()
62 }
63}
64
65
66#[derive(Reflect, Clone, Debug, Hash, PartialEq, Eq)]
67#[cfg_attr(any(feature = "actionset_loader"), derive(Serialize, Deserialize))]
68#[cfg_attr(any(feature = "actionset_loader"), serde(transparent))]
69pub struct CurveIdentifier(String);
70
71impl CurveIdentifier {
72 pub fn from_string(value: String) -> Self {
73 Self(value)
74 }
75}
76
77impl<IS: Into<String>> From<IS> for CurveIdentifier {
78 fn from(value: IS) -> Self {
79 Self::from_string(value.into())
80 }
81}
82
83impl Borrow<str> for CurveIdentifier {
84 fn borrow(&self) -> &str {
85 self.0.borrow()
86 }
87}
88
89impl Borrow<str> for &CurveIdentifier {
90 fn borrow(&self) -> &str {
91 self.0.borrow()
92 }
93}
94
95impl Borrow<String> for CurveIdentifier {
96 fn borrow(&self) -> &String {
97 self.0.borrow()
98 }
99}
100
101impl Borrow<String> for &CurveIdentifier {
102 fn borrow(&self) -> &String {
103 self.0.borrow()
104 }
105}
106
107
108#[derive(Reflect, Clone, Debug, Hash, PartialEq, Eq)]
109#[cfg_attr(any(feature = "actionset_loader"), derive(Serialize, Deserialize))]
110#[cfg_attr(any(feature = "actionset_loader"), serde(transparent))]
111pub struct ConsiderationIdentifier(String);
112
113
114impl ConsiderationIdentifier {
115 pub fn from_string(value: String) -> Self {
116 Self(value)
117 }
118}
119
120impl<IS: Into<String>> From<IS> for ConsiderationIdentifier {
121 fn from(value: IS) -> Self {
122 Self::from_string(value.into())
123 }
124}
125
126impl Borrow<str> for ConsiderationIdentifier {
127 fn borrow(&self) -> &str {
128 self.0.borrow()
129 }
130}
131
132impl core::fmt::Display for ConsiderationIdentifier {
133 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
134 self.0.fmt(f)
135 }
136}