-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move pp::Printer helpers to direct impl
- Loading branch information
1 parent
e91dbc5
commit cab4532
Showing
10 changed files
with
64 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -162,6 +162,7 @@ pub mod visit; | |
pub mod print { | ||
pub mod pp; | ||
pub mod pprust; | ||
mod helpers; | ||
} | ||
|
||
pub mod ext { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
use std::borrow::Cow; | ||
use crate::print::pp::Printer; | ||
|
||
impl Printer { | ||
pub fn word_space<W: Into<Cow<'static, str>>>(&mut self, w: W) { | ||
self.word(w); | ||
self.space(); | ||
} | ||
|
||
pub fn popen(&mut self) { | ||
self.word("("); | ||
} | ||
|
||
pub fn pclose(&mut self) { | ||
self.word(")"); | ||
} | ||
|
||
pub fn hardbreak_if_not_bol(&mut self) { | ||
if !self.is_beginning_of_line() { | ||
self.hardbreak() | ||
} | ||
} | ||
|
||
pub fn space_if_not_bol(&mut self) { | ||
if !self.is_beginning_of_line() { self.space(); } | ||
} | ||
|
||
pub fn nbsp(&mut self) { self.word(" ") } | ||
|
||
pub fn word_nbsp<S: Into<Cow<'static, str>>>(&mut self, w: S) { | ||
self.word(w); | ||
self.nbsp() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters