MCPcopy Create free account
hub / github.com/emwalker/digraph / topic_details

Method topic_details

backend/src/git/ext.rs:54–83  ·  view source on GitHub ↗
(
        &self,
        context: RepoId,
    )

Source from the content-addressed store, hash-verified

52 }
53
54 pub fn topic_details(
55 &self,
56 context: RepoId,
57 ) -> Result<(Vec<RepoTopicWrapper>, RepoTopicWrapper)> {
58 let mut display_topic: Option<RepoTopicWrapper> = match self.0.get(&context) {
59 Some(repo_topic) => {
60 if repo_topic.has_details() {
61 Some((context, repo_topic).try_into()?)
62 } else {
63 None
64 }
65 }
66 None => None,
67 };
68
69 let mut topics = vec![];
70
71 for (&repo_id, object) in self.iter() {
72 if display_topic.is_none() && object.has_details() {
73 display_topic = Some((repo_id, object).try_into()?);
74 }
75 topics.push((repo_id, object).try_into()?);
76 }
77
78 if display_topic.is_none() {
79 return Err(Error::Repo("no display topic".into()));
80 }
81
82 Ok((topics, display_topic.unwrap()))
83 }
84
85 pub fn iter(&self) -> std::collections::btree_map::Iter<'_, RepoId, RepoObject> {
86 self.0.iter()

Callers 1

finalizeMethod · 0.80

Calls 5

RepoClass · 0.85
has_detailsMethod · 0.80
getMethod · 0.45
try_intoMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected