(&self, schema: &ArraySchema)
| 183 | // ─── Internal helpers ──────────────────────────────────────────────────── |
| 184 | |
| 185 | fn write_schema_to_doc(&self, schema: &ArraySchema) -> ArrayResult<()> { |
| 186 | let schema_bytes = |
| 187 | zerompk::to_msgpack_vec(schema).map_err(|e| ArrayError::SegmentCorruption { |
| 188 | detail: format!("schema encode failed: {e}"), |
| 189 | })?; |
| 190 | let root: LoroMap = self.doc.get_map("root"); |
| 191 | root.insert("content", LoroValue::Binary(schema_bytes.into())) |
| 192 | .map_err(|e| ArrayError::LoroError { |
| 193 | detail: format!("loro map insert failed: {e}"), |
| 194 | })?; |
| 195 | Ok(()) |
| 196 | } |
| 197 | |
| 198 | fn read_content_bytes(&self, root: &LoroMap) -> ArrayResult<Vec<u8>> { |
| 199 | match root.get("content") { |
no test coverage detected