Skip to main content

nominal_api/conjure/objects/scout/metadata/
rename_label.rs

1/// Rename or merge one or more source labels into a single target label.
2#[derive(
3    Debug,
4    Clone,
5    conjure_object::serde::Serialize,
6    conjure_object::serde::Deserialize,
7    PartialEq,
8    Eq,
9    PartialOrd,
10    Ord,
11    Hash
12)]
13#[serde(crate = "conjure_object::serde")]
14#[conjure_object::private::staged_builder::staged_builder]
15#[builder(crate = conjure_object::private::staged_builder, update, inline)]
16pub struct RenameLabel {
17    #[builder(default, set(item(type = String, into)))]
18    #[serde(
19        rename = "source",
20        skip_serializing_if = "std::collections::BTreeSet::is_empty",
21        default
22    )]
23    source: std::collections::BTreeSet<String>,
24    #[builder(into)]
25    #[serde(rename = "target")]
26    target: String,
27}
28impl RenameLabel {
29    /// Constructs a new instance of the type.
30    #[inline]
31    pub fn new(target: impl Into<String>) -> Self {
32        Self::builder().target(target).build()
33    }
34    #[inline]
35    pub fn source(&self) -> &std::collections::BTreeSet<String> {
36        &self.source
37    }
38    #[inline]
39    pub fn target(&self) -> &str {
40        &*self.target
41    }
42}