Remove a resource at a given index from the table. Returns the resource if it was present.
(&self, from: u32, to: u32)
| 106 | /// Remove a resource at a given index from the table. Returns the resource |
| 107 | /// if it was present. |
| 108 | pub fn renumber(&self, from: u32, to: u32) -> Result<(), Error> { |
| 109 | let map = &mut self.0.write().unwrap().map; |
| 110 | let from_entry = map.remove(&from).ok_or(Error::badf())?; |
| 111 | map.insert(to, from_entry); |
| 112 | Ok(()) |
| 113 | } |
| 114 | } |