MCPcopy Index your code
hub / github.com/emwalker/digraph / markdown

Method markdown

backend/src/git/activity.rs:52–88  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

50 }
51
52 pub fn markdown(&self) -> String {
53 fn quote(name: &String) -> String {
54 format!("\"{name}\"")
55 }
56
57 match self.len() {
58 0 => "[missing synonym]".to_owned(),
59 1 => self.0.values().map(quote).join(""),
60
61 2 => self.0.values().map(quote).join(" and "),
62
63 3 => {
64 let mut result = String::new();
65
66 for (i, (_locale, name)) in self.0.iter().enumerate() {
67 match i {
68 0 => {
69 result.push_str(&quote(name));
70 result.push_str(", ");
71 }
72 1 => {
73 result.push_str(&quote(name));
74 result.push_str(" and ");
75 }
76 2 => {
77 result.push_str(&quote(name));
78 }
79 _ => unreachable!("unexpected index"),
80 }
81 }
82
83 result
84 }
85
86 _ => "several synonyms".to_owned(),
87 }
88 }
89
90 pub fn len(&self) -> usize {
91 self.0.len()

Callers 2

activityMethod · 0.80
activityMethod · 0.80

Calls 5

lenMethod · 0.45
iterMethod · 0.45
getMethod · 0.45
is_emptyMethod · 0.45
prefixMethod · 0.45

Tested by

no test coverage detected