Skip to main content

nominal_api/conjure/objects/datasource/api/
channel_prefix_tree_node.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 ChannelPrefixTreeNode {
16    #[builder(into)]
17    #[serde(rename = "part")]
18    part: String,
19    #[builder(default, set(item(type = super::ChannelPrefixTreeNode)))]
20    #[serde(
21        rename = "children",
22        skip_serializing_if = "std::collections::BTreeSet::is_empty",
23        default
24    )]
25    children: std::collections::BTreeSet<super::ChannelPrefixTreeNode>,
26}
27impl ChannelPrefixTreeNode {
28    /// Constructs a new instance of the type.
29    #[inline]
30    pub fn new(part: impl Into<String>) -> Self {
31        Self::builder().part(part).build()
32    }
33    /// Should be combined with the ancestor parts and the delimiter to form the full prefix.
34    #[inline]
35    pub fn part(&self) -> &str {
36        &*self.part
37    }
38    #[inline]
39    pub fn children(&self) -> &std::collections::BTreeSet<super::ChannelPrefixTreeNode> {
40        &self.children
41    }
42}