Skip to main content

nominal_api/conjure/objects/scout/channel/api/
channel_entry.rs

1/// A channel (by name) found in one or more locators of the frame. `locatorMetadata` has one
2/// entry per locator the channel exists in; locators not represented here are ones where the
3/// channel does not exist.
4#[derive(
5    Debug,
6    Clone,
7    conjure_object::serde::Serialize,
8    conjure_object::serde::Deserialize,
9    PartialEq,
10    Eq,
11    PartialOrd,
12    Ord,
13    Hash
14)]
15#[serde(crate = "conjure_object::serde")]
16#[conjure_object::private::staged_builder::staged_builder]
17#[builder(crate = conjure_object::private::staged_builder, update, inline)]
18pub struct ChannelEntry {
19    #[builder(into)]
20    #[serde(rename = "name")]
21    name: String,
22    #[builder(default, set(item(type = super::LocatorChannelMetadata)))]
23    #[serde(
24        rename = "locatorMetadata",
25        skip_serializing_if = "std::collections::BTreeSet::is_empty",
26        default
27    )]
28    locator_metadata: std::collections::BTreeSet<super::LocatorChannelMetadata>,
29}
30impl ChannelEntry {
31    /// Constructs a new instance of the type.
32    #[inline]
33    pub fn new(name: impl Into<String>) -> Self {
34        Self::builder().name(name).build()
35    }
36    #[inline]
37    pub fn name(&self) -> &str {
38        &*self.name
39    }
40    #[inline]
41    pub fn locator_metadata(
42        &self,
43    ) -> &std::collections::BTreeSet<super::LocatorChannelMetadata> {
44        &self.locator_metadata
45    }
46}