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