Skip to main content

nominal_api/conjure/objects/scout/channel/api/
locator_with_delimiter.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 LocatorWithDelimiter {
16    #[builder(custom(type = super::Locator, convert = Box::new))]
17    #[serde(rename = "locator")]
18    locator: Box<super::Locator>,
19    #[builder(default, into)]
20    #[serde(rename = "delimiter", skip_serializing_if = "Option::is_none", default)]
21    delimiter: Option<String>,
22}
23impl LocatorWithDelimiter {
24    /// Constructs a new instance of the type.
25    #[inline]
26    pub fn new(locator: super::Locator) -> Self {
27        Self::builder().locator(locator).build()
28    }
29    #[inline]
30    pub fn locator(&self) -> &super::Locator {
31        &*self.locator
32    }
33    /// Absent when the locator's data source has no indexed prefix tree
34    /// (callers should fall back to flat search for those locators).
35    #[inline]
36    pub fn delimiter(&self) -> Option<&str> {
37        self.delimiter.as_ref().map(|o| &**o)
38    }
39}