nominal_api_conjure/conjure/objects/scout/layout/api/
document_layout.rs1#[derive(
4 Debug,
5 Clone,
6 conjure_object::serde::Serialize,
7 conjure_object::serde::Deserialize,
8 conjure_object::private::DeriveWith
9)]
10#[serde(crate = "conjure_object::serde")]
11#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
12#[conjure_object::private::staged_builder::staged_builder]
13#[builder(crate = conjure_object::private::staged_builder, update, inline)]
14pub struct DocumentLayout {
15 #[serde(rename = "id")]
16 id: conjure_object::Uuid,
17 #[builder(into)]
18 #[serde(rename = "textEditorJson")]
19 text_editor_json: String,
20 #[builder(
21 default,
22 map(key(type = conjure_object::Uuid), value(type = super::DocumentNodeObject))
23 )]
24 #[serde(
25 rename = "nodes",
26 serialize_with = "conjure_object::private::serialize_map_keys_as_strings",
27 skip_serializing_if = "std::collections::BTreeMap::is_empty",
28 default
29 )]
30 nodes: std::collections::BTreeMap<conjure_object::Uuid, super::DocumentNodeObject>,
31}
32impl DocumentLayout {
33 #[inline]
35 pub fn new(id: conjure_object::Uuid, text_editor_json: impl Into<String>) -> Self {
36 Self::builder().id(id).text_editor_json(text_editor_json).build()
37 }
38 #[inline]
39 pub fn id(&self) -> conjure_object::Uuid {
40 self.id
41 }
42 #[inline]
43 pub fn text_editor_json(&self) -> &str {
44 &*self.text_editor_json
45 }
46 #[inline]
47 pub fn nodes(
48 &self,
49 ) -> &std::collections::BTreeMap<conjure_object::Uuid, super::DocumentNodeObject> {
50 &self.nodes
51 }
52}