rstgen/java/
utils.rs

1use {Cons, Element, IntoTokens, Java, Tokens};
2
3/// Format a block comment, starting with `/**`, and ending in `*/`.
4pub struct BlockComment<'el>(pub Vec<Cons<'el>>);
5
6impl<'el> IntoTokens<'el, Java<'el>> for BlockComment<'el> {
7    fn into_tokens(self) -> Tokens<'el, Java<'el>> {
8        let mut t = Tokens::new();
9
10        if self.0.is_empty() {
11            return t;
12        }
13
14        t.push("/**");
15
16        for line in self.0 {
17            t.push(" * ");
18            t.append(line);
19        }
20
21        t.push(" */");
22        t.push(Element::PushSpacing);
23
24        t
25    }
26}