Skip to main content

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

1/// A prefix node collapsed across locators in the batch. `presentAtLocators` lists the
2/// locators where this prefix exists, each tagged with the set of entry ids whose scope
3/// expanded to that locator.
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 BatchedPrefixEntry {
19    #[builder(into)]
20    #[serde(rename = "part")]
21    part: String,
22    #[builder(default, set(item(type = super::BatchedLocator)))]
23    #[serde(
24        rename = "presentAtLocators",
25        skip_serializing_if = "std::collections::BTreeSet::is_empty",
26        default
27    )]
28    present_at_locators: std::collections::BTreeSet<super::BatchedLocator>,
29}
30impl BatchedPrefixEntry {
31    /// Constructs a new instance of the type.
32    #[inline]
33    pub fn new(part: impl Into<String>) -> Self {
34        Self::builder().part(part).build()
35    }
36    #[inline]
37    pub fn part(&self) -> &str {
38        &*self.part
39    }
40    #[inline]
41    pub fn present_at_locators(
42        &self,
43    ) -> &std::collections::BTreeSet<super::BatchedLocator> {
44        &self.present_at_locators
45    }
46}