Real-time index of opencode sessions
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Implement FromStr for PartType instead of from_str method

rektide 651e2022 12727f0b

+17 -15
+17 -15
src/index.rs
··· 89 89 Retry, 90 90 } 91 91 92 - impl PartType { 93 - pub fn from_str(s: &str) -> Option<Self> { 92 + impl std::str::FromStr for PartType { 93 + type Err = (); 94 + 95 + fn from_str(s: &str) -> std::result::Result<Self, Self::Err> { 94 96 match s { 95 - "text" => Some(Self::Text), 96 - "reasoning" => Some(Self::Reasoning), 97 - "tool" => Some(Self::Tool), 98 - "file" => Some(Self::File), 99 - "step-start" => Some(Self::StepStart), 100 - "step-finish" => Some(Self::StepFinish), 101 - "snapshot" => Some(Self::Snapshot), 102 - "patch" => Some(Self::Patch), 103 - "agent" => Some(Self::Agent), 104 - "subtask" => Some(Self::Subtask), 105 - "compaction" => Some(Self::Compaction), 106 - "retry" => Some(Self::Retry), 107 - _ => None, 97 + "text" => Ok(Self::Text), 98 + "reasoning" => Ok(Self::Reasoning), 99 + "tool" => Ok(Self::Tool), 100 + "file" => Ok(Self::File), 101 + "step-start" => Ok(Self::StepStart), 102 + "step-finish" => Ok(Self::StepFinish), 103 + "snapshot" => Ok(Self::Snapshot), 104 + "patch" => Ok(Self::Patch), 105 + "agent" => Ok(Self::Agent), 106 + "subtask" => Ok(Self::Subtask), 107 + "compaction" => Ok(Self::Compaction), 108 + "retry" => Ok(Self::Retry), 109 + _ => Err(()), 108 110 } 109 111 } 110 112 }