const NOTIFS_TOKEN_DEPRECATED: &str = "notifs"; const NOTIFS_TOKEN: &str = "notifications"; impl TokenSerializable for AlgoTimeline { fn serialize_tokens(&self, writer: &mut TokenWriter) { match self { TimelineKind::List(list_kind) => list_kind.serialize_tokens(writer), TimelineKind::Algo(algo_timeline) => algo_timeline.serialize_tokens(writer), TimelineKind::Notifications(pk_src) => { writer.write_token(NOTIFS_TOKEN); pk_src.serialize_tokens(writer); } } } fn parse_from_tokens<'a>(parser: &mut TokenParser<'a>) -> Result> { TokenParser::alt( parser, &[ |p| Ok(TimelineKind::List(ListKind::parse_from_tokens(p)?)), |p| Ok(TimelineKind::Algo(AlgoTimeline::parse_from_tokens(p)?)), |p| { // still handle deprecated form (notifs) p.parse_any_token([NOTIFS_TOKEN, NOTIFS_TOKEN_DEPRECATED])?; Ok(TimelineKind::Notifications( PubkeySource::parse_from_tokens(p)?, )) }, ], ); } }