Skip to main content

nominal_api/conjure/objects/scout/units/api/
get_units_response.rs

1#[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 GetUnitsResponse {
16    #[builder(
17        default,
18        map(
19            key(type = super::UnitProperty),
20            value(
21                custom(
22                    type = impl
23                    IntoIterator<Item = super::Unit>,
24                    convert = |v|v.into_iter().collect()
25                )
26            )
27        )
28    )]
29    #[serde(
30        rename = "unitsByProperty",
31        skip_serializing_if = "std::collections::BTreeMap::is_empty",
32        default
33    )]
34    units_by_property: std::collections::BTreeMap<
35        super::UnitProperty,
36        std::collections::BTreeSet<super::Unit>,
37    >,
38}
39impl GetUnitsResponse {
40    /// Constructs a new instance of the type.
41    #[inline]
42    pub fn new() -> Self {
43        Self::builder().build()
44    }
45    #[inline]
46    pub fn units_by_property(
47        &self,
48    ) -> &std::collections::BTreeMap<
49        super::UnitProperty,
50        std::collections::BTreeSet<super::Unit>,
51    > {
52        &self.units_by_property
53    }
54}