| 24 | } |
| 25 | |
| 26 | pub fn link_details(&self, context: RepoId) -> Result<(Vec<RepoLinkWrapper>, RepoLinkWrapper)> { |
| 27 | let mut display_link: Option<RepoLinkWrapper> = match self.0.get(&context) { |
| 28 | Some(repo_topic) => { |
| 29 | if repo_topic.has_details() { |
| 30 | Some((context, repo_topic).try_into()?) |
| 31 | } else { |
| 32 | None |
| 33 | } |
| 34 | } |
| 35 | None => None, |
| 36 | }; |
| 37 | |
| 38 | let mut topics = vec![]; |
| 39 | |
| 40 | for (&repo_id, object) in self.iter() { |
| 41 | if display_link.is_none() && object.has_details() { |
| 42 | display_link = Some((repo_id, object).try_into()?); |
| 43 | } |
| 44 | topics.push((repo_id, object).try_into()?); |
| 45 | } |
| 46 | |
| 47 | if display_link.is_none() { |
| 48 | return Err(Error::Repo("no display link".into())); |
| 49 | } |
| 50 | |
| 51 | Ok((topics, display_link.unwrap())) |
| 52 | } |
| 53 | |
| 54 | pub fn topic_details( |
| 55 | &self, |