Get the ID of this part, regardless of variant
(&self)
| 442 | impl Part { |
| 443 | /// Get the ID of this part, regardless of variant |
| 444 | pub fn id(&self) -> Option<&str> { |
| 445 | match self { |
| 446 | Part::Text { id, .. } => Some(id), |
| 447 | Part::Subtask(p) => Some(&p.id), |
| 448 | Part::Reasoning { id, .. } => Some(id), |
| 449 | Part::File(p) => Some(&p.id), |
| 450 | Part::Tool(p) => Some(&p.id), |
| 451 | Part::StepStart(p) => Some(&p.id), |
| 452 | Part::StepFinish(p) => Some(&p.id), |
| 453 | Part::Snapshot { id, .. } => Some(id), |
| 454 | Part::Patch { id, .. } => Some(id), |
| 455 | Part::Agent(p) => Some(&p.id), |
| 456 | Part::Retry(p) => Some(&p.id), |
| 457 | Part::Compaction(p) => Some(&p.id), |
| 458 | } |
| 459 | } |
| 460 | } |
| 461 | |
| 462 | #[derive(Debug, Clone, Serialize, Deserialize)] |