]>
Commit | Line | Data |
---|---|---|
416331ca | 1 | use crate::print::pp::Printer; |
dfeec247 | 2 | use std::borrow::Cow; |
416331ca XL |
3 | |
4 | impl Printer { | |
5 | pub fn word_space<W: Into<Cow<'static, str>>>(&mut self, w: W) { | |
6 | self.word(w); | |
7 | self.space(); | |
8 | } | |
9 | ||
10 | pub fn popen(&mut self) { | |
11 | self.word("("); | |
12 | } | |
13 | ||
14 | pub fn pclose(&mut self) { | |
15 | self.word(")"); | |
16 | } | |
17 | ||
18 | pub fn hardbreak_if_not_bol(&mut self) { | |
19 | if !self.is_beginning_of_line() { | |
20 | self.hardbreak() | |
21 | } | |
22 | } | |
23 | ||
24 | pub fn space_if_not_bol(&mut self) { | |
dfeec247 XL |
25 | if !self.is_beginning_of_line() { |
26 | self.space(); | |
27 | } | |
416331ca XL |
28 | } |
29 | ||
dfeec247 XL |
30 | pub fn nbsp(&mut self) { |
31 | self.word(" ") | |
32 | } | |
416331ca XL |
33 | |
34 | pub fn word_nbsp<S: Into<Cow<'static, str>>>(&mut self, w: S) { | |
35 | self.word(w); | |
36 | self.nbsp() | |
37 | } | |
38 | } |