nominal_api/conjure/objects/scout/run/api/
unit.rs1#[derive(
2 Debug,
3 Clone,
4 conjure_object::serde::Serialize,
5 conjure_object::serde::Deserialize,
6 PartialEq,
7 Eq,
8 PartialOrd,
9 Ord,
10 Hash
11)]
12#[serde(crate = "conjure_object::serde")]
13#[conjure_object::private::staged_builder::staged_builder]
14#[builder(crate = conjure_object::private::staged_builder, update, inline)]
15pub struct Unit {
16 #[builder(default, into)]
17 #[serde(rename = "name", skip_serializing_if = "Option::is_none", default)]
18 name: Option<String>,
19 #[builder(into)]
20 #[serde(rename = "symbol")]
21 symbol: String,
22}
23impl Unit {
24 #[inline]
26 pub fn new(symbol: impl Into<String>) -> Self {
27 Self::builder().symbol(symbol).build()
28 }
29 #[deprecated(note = "use the units service for additional display metadata")]
30 #[inline]
31 pub fn name(&self) -> Option<&str> {
32 self.name.as_ref().map(|o| &**o)
33 }
34 #[inline]
35 pub fn symbol(&self) -> &str {
36 &*self.symbol
37 }
38}