Remove a specific part from a message
(&mut self, msg_id: &str, part_id: &str)
| 509 | |
| 510 | /// Remove a specific part from a message |
| 511 | pub fn remove_part(&mut self, msg_id: &str, part_id: &str) -> Option<MessagePart> { |
| 512 | let msg = self.get_message_mut(msg_id)?; |
| 513 | if let Some(pos) = msg.parts.iter().position(|p| p.id == part_id) { |
| 514 | let removed = msg.parts.remove(pos); |
| 515 | self.touch(); |
| 516 | Some(removed) |
| 517 | } else { |
| 518 | None |
| 519 | } |
| 520 | } |
| 521 | |
| 522 | // ======================================================================== |
| 523 | // Usage Aggregation |