Insert a LoroMap container into a block list at the specified index. Returns the created LoroMap so callers can populate its fields.
(
doc: &LoroDoc,
collection: &str,
row_id: &str,
list_path: &str,
index: usize,
)
| 35 | /// |
| 36 | /// Returns the created LoroMap so callers can populate its fields. |
| 37 | pub fn list_insert_container( |
| 38 | doc: &LoroDoc, |
| 39 | collection: &str, |
| 40 | row_id: &str, |
| 41 | list_path: &str, |
| 42 | index: usize, |
| 43 | ) -> Result<LoroMap> { |
| 44 | let list = get_movable_list(doc, collection, row_id, list_path)?; |
| 45 | let idx = index.min(list.len()); |
| 46 | list.insert_container(idx, LoroMap::new()) |
| 47 | .map_err(|e| CrdtError::Loro(format!("list insert container at {idx}: {e}"))) |
| 48 | } |
| 49 | |
| 50 | /// Delete an element from a block list at the specified index. |
| 51 | pub fn list_delete( |