Skip to main content

nominal_api/conjure/objects/scout/chartdefinition/api/
bit_flag.rs

1/// The settings for a bit flag mapping. Each position should be unique. Position 0 represents the least significant bit
2/// and position 31 represents the most significant bit.
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 BitFlag {
18    #[serde(rename = "position")]
19    position: i32,
20    #[builder(into)]
21    #[serde(rename = "label")]
22    label: String,
23}
24impl BitFlag {
25    /// Constructs a new instance of the type.
26    #[inline]
27    pub fn new(position: i32, label: impl Into<String>) -> Self {
28        Self::builder().position(position).label(label).build()
29    }
30    #[inline]
31    pub fn position(&self) -> i32 {
32        self.position
33    }
34    #[inline]
35    pub fn label(&self) -> &str {
36        &*self.label
37    }
38}