chiark / gitweb /
apitest: updates: handle Delete
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 1 May 2022 20:13:04 +0000 (21:13 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 1 May 2022 20:13:04 +0000 (21:13 +0100)
We blank out the info in the slot.  That's probably the best we can do
with the current data model.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
apitest/atmain.rs

index 2f7bebcaa8f8e4ff72bbbb347bb41bad84c1283a..69b727a7ef4279721f08a31e06d8f4aa926313c9 100644 (file)
@@ -444,6 +444,10 @@ pub fn update_update_pieces<PI:Idx>(
     let (op, d) = v["op"].as_object().unwrap().iter().next().unwrap();
 
     match op.as_str() {
+      "Delete" => {
+        let p = p.unwrap();
+        p.info = default();
+      },
       "Insert" | "InsertQuiet" => {
         assert!(p.is_none());
         let piece = v["piece"].as_str().unwrap();