Skip to main content

nominal_api/conjure/objects/scout/layout/api/
canvas_layout.rs

1/// A layout of objects freely placed on a canvas.
2#[derive(
3    Debug,
4    Clone,
5    conjure_object::serde::Serialize,
6    conjure_object::serde::Deserialize,
7    conjure_object::private::DeriveWith
8)]
9#[serde(crate = "conjure_object::serde")]
10#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
11#[conjure_object::private::staged_builder::staged_builder]
12#[builder(crate = conjure_object::private::staged_builder, update, inline)]
13pub struct CanvasLayout {
14    #[serde(rename = "id")]
15    id: conjure_object::Uuid,
16    #[builder(
17        default,
18        map(key(type = conjure_object::Uuid), value(type = super::CanvasObject))
19    )]
20    #[serde(
21        rename = "objects",
22        serialize_with = "conjure_object::private::serialize_map_keys_as_strings",
23        skip_serializing_if = "std::collections::BTreeMap::is_empty",
24        default
25    )]
26    objects: std::collections::BTreeMap<conjure_object::Uuid, super::CanvasObject>,
27}
28impl CanvasLayout {
29    /// Constructs a new instance of the type.
30    #[inline]
31    pub fn new(id: conjure_object::Uuid) -> Self {
32        Self::builder().id(id).build()
33    }
34    #[inline]
35    pub fn id(&self) -> conjure_object::Uuid {
36        self.id
37    }
38    #[inline]
39    pub fn objects(
40        &self,
41    ) -> &std::collections::BTreeMap<conjure_object::Uuid, super::CanvasObject> {
42        &self.objects
43    }
44}