(input: &str)
| 48 | } |
| 49 | |
| 50 | fn parse(input: &str) -> Result<Self> { |
| 51 | use std::str::FromStr; |
| 52 | |
| 53 | let parts: Vec<String> = input.trim().split(':').map(str::to_string).collect(); |
| 54 | if !parts.len() == 2 { |
| 55 | return Err(Error::Parse(format!("invalid topic spec: {input}"))); |
| 56 | } |
| 57 | |
| 58 | let op = TopicSpecOperation::from_str(&parts[0])?; |
| 59 | Ok(Self { |
| 60 | op, |
| 61 | id: ExternalId::try_from(&parts[1])?, |
| 62 | }) |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | #[derive(Clone, Debug, Eq, PartialEq)] |