Skip to main content

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

1/// A prefix node collapsed across locators. `presentAtLocators` lists the locators where this
2/// prefix exists.
3#[derive(
4    Debug,
5    Clone,
6    conjure_object::serde::Serialize,
7    conjure_object::serde::Deserialize,
8    PartialEq,
9    Eq,
10    PartialOrd,
11    Ord,
12    Hash
13)]
14#[serde(crate = "conjure_object::serde")]
15#[conjure_object::private::staged_builder::staged_builder]
16#[builder(crate = conjure_object::private::staged_builder, update, inline)]
17pub struct PrefixEntry {
18    #[builder(into)]
19    #[serde(rename = "part")]
20    part: String,
21    #[builder(default, set(item(type = super::Locator)))]
22    #[serde(
23        rename = "presentAtLocators",
24        skip_serializing_if = "std::collections::BTreeSet::is_empty",
25        default
26    )]
27    present_at_locators: std::collections::BTreeSet<super::Locator>,
28}
29impl PrefixEntry {
30    /// Constructs a new instance of the type.
31    #[inline]
32    pub fn new(part: impl Into<String>) -> Self {
33        Self::builder().part(part).build()
34    }
35    #[inline]
36    pub fn part(&self) -> &str {
37        &*self.part
38    }
39    #[inline]
40    pub fn present_at_locators(&self) -> &std::collections::BTreeSet<super::Locator> {
41        &self.present_at_locators
42    }
43}