MCPcopy Create free account
hub / github.com/PerroEngine/Perro / write

Method write

perro_source/runtime_project/perro_scene/src/scene_doc.rs:124–157  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

122 } else {
123 HashMap::new()
124 };
125 Self { doc, value_vars }
126 }
127
128 fn write(&self) -> String {
129 let mut out = String::new();
130 if let Some(root) = &self.doc.scene.root {
131 out.push_str("$root = ");
132 out.push('@');
133 out.push_str(self.doc.scene.key_name_or_id(*root).as_ref());
134 out.push('\n');
135 }
136
137 let mut dedupe_items = self
138 .value_vars
139 .iter()
140 .map(|(value, name)| (name.as_str(), value.as_str()))
141 .collect::<Vec<_>>();
142 dedupe_items.sort_by(|a, b| a.0.cmp(b.0));
143 for (name, value) in dedupe_items {
144 out.push('$');
145 out.push_str(name);
146 out.push_str(" = ");
147 out.push_str(value);
148 out.push('\n');
149 }
150
151 if !out.is_empty() {
152 out.push('\n');
153 }
154
155 for node in self.doc.scene.nodes.iter() {
156 self.write_node(node, &mut out);
157 out.push('\n');
158 }
159
160 out

Callers 9

intern_localization_strFunction · 0.45
feed_variantFunction · 0.45
text_edit_fingerprintFunction · 0.45
ui_payload_fingerprintFunction · 0.45
load_query_mesh_dataMethod · 0.45
to_text_with_dedupMethod · 0.45

Calls 7

key_name_or_idMethod · 0.80
write_nodeMethod · 0.80
pushMethod · 0.45
as_refMethod · 0.45
iterMethod · 0.45
as_strMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected