[−][src]Trait syntax::print::pprust::PrintState
Required methods
fn writer(&mut self) -> &mut Printer<'a>
fn boxes(&mut self) -> &mut Vec<Breaks>
fn comments(&mut self) -> &mut Option<Vec<Comment>>
fn cur_cmnt(&mut self) -> &mut usize
Provided methods
fn word_space<S: Into<Cow<'static, str>>>(&mut self, w: S) -> Result<()>
fn popen(&mut self) -> Result<()>
fn pclose(&mut self) -> Result<()>
fn is_begin(&mut self) -> bool
fn is_end(&mut self) -> bool
fn is_bol(&mut self) -> bool
fn hardbreak_if_not_bol(&mut self) -> Result<()>
fn rbox(&mut self, u: usize, b: Breaks) -> Result<()>
fn ibox(&mut self, u: usize) -> Result<()>
fn end(&mut self) -> Result<()>
fn commasep<T, F>(&mut self, b: Breaks, elts: &[T], op: F) -> Result<()> where
F: FnMut(&mut Self, &T) -> Result<()>,
F: FnMut(&mut Self, &T) -> Result<()>,
fn maybe_print_comment(&mut self, pos: BytePos) -> Result<()>
fn print_comment(&mut self, cmnt: &Comment) -> Result<()>
fn next_comment(&mut self) -> Option<Comment>
fn print_literal(&mut self, lit: &Lit) -> Result<()>
fn print_string(&mut self, st: &str, style: StrStyle) -> Result<()>
fn print_inner_attributes(&mut self, attrs: &[Attribute]) -> Result<()>
fn print_inner_attributes_no_trailing_hardbreak(
&mut self,
attrs: &[Attribute]
) -> Result<()>
&mut self,
attrs: &[Attribute]
) -> Result<()>
fn print_outer_attributes(&mut self, attrs: &[Attribute]) -> Result<()>
fn print_inner_attributes_inline(&mut self, attrs: &[Attribute]) -> Result<()>
fn print_outer_attributes_inline(&mut self, attrs: &[Attribute]) -> Result<()>
fn print_either_attributes(
&mut self,
attrs: &[Attribute],
kind: AttrStyle,
is_inline: bool,
trailing_hardbreak: bool
) -> Result<()>
&mut self,
attrs: &[Attribute],
kind: AttrStyle,
is_inline: bool,
trailing_hardbreak: bool
) -> Result<()>
fn print_attribute_path(&mut self, path: &Path) -> Result<()>
fn print_attribute(&mut self, attr: &Attribute) -> Result<()>
fn print_attribute_inline(
&mut self,
attr: &Attribute,
is_inline: bool
) -> Result<()>
&mut self,
attr: &Attribute,
is_inline: bool
) -> Result<()>
fn print_meta_list_item(&mut self, item: &NestedMetaItem) -> Result<()>
fn print_meta_item(&mut self, item: &MetaItem) -> Result<()>
fn print_tt(&mut self, tt: TokenTree) -> Result<()>
This doesn't deserve to be called "pretty" printing, but it should be meaning-preserving. A quick hack that might help would be to look at the spans embedded in the TTs to decide where to put spaces and newlines. But it'd be better to parse these according to the grammar of the appropriate macro, transcribe back into the grammar we just parsed from, and then pretty-print the resulting AST nodes (so, e.g., we print expression arguments as expressions). It can be done! I think.
fn print_tts(&mut self, tts: TokenStream) -> Result<()>
fn space_if_not_bol(&mut self) -> Result<()>
fn nbsp(&mut self) -> Result<()>
fn print_dollar_crate(&mut self, ident: Ident) -> Result<()>
Implementors
impl<'a> PrintState<'a> for State<'a>
[src]
fn writer(&mut self) -> &mut Printer<'a>
[src]
fn boxes(&mut self) -> &mut Vec<Breaks>
[src]
fn comments(&mut self) -> &mut Option<Vec<Comment>>
[src]
fn cur_cmnt(&mut self) -> &mut usize
[src]
fn word_space<S: Into<Cow<'static, str>>>(&mut self, w: S) -> Result<()>
[src]
fn popen(&mut self) -> Result<()>
[src]
fn pclose(&mut self) -> Result<()>
[src]
fn is_begin(&mut self) -> bool
[src]
fn is_end(&mut self) -> bool
[src]
fn is_bol(&mut self) -> bool
[src]
fn hardbreak_if_not_bol(&mut self) -> Result<()>
[src]
fn rbox(&mut self, u: usize, b: Breaks) -> Result<()>
[src]
fn ibox(&mut self, u: usize) -> Result<()>
[src]
fn end(&mut self) -> Result<()>
[src]
fn commasep<T, F>(&mut self, b: Breaks, elts: &[T], op: F) -> Result<()> where
F: FnMut(&mut Self, &T) -> Result<()>,
[src]
F: FnMut(&mut Self, &T) -> Result<()>,
fn maybe_print_comment(&mut self, pos: BytePos) -> Result<()>
[src]
fn print_comment(&mut self, cmnt: &Comment) -> Result<()>
[src]
fn next_comment(&mut self) -> Option<Comment>
[src]
fn print_literal(&mut self, lit: &Lit) -> Result<()>
[src]
fn print_string(&mut self, st: &str, style: StrStyle) -> Result<()>
[src]
fn print_inner_attributes(&mut self, attrs: &[Attribute]) -> Result<()>
[src]
fn print_inner_attributes_no_trailing_hardbreak(
&mut self,
attrs: &[Attribute]
) -> Result<()>
[src]
&mut self,
attrs: &[Attribute]
) -> Result<()>
fn print_outer_attributes(&mut self, attrs: &[Attribute]) -> Result<()>
[src]
fn print_inner_attributes_inline(&mut self, attrs: &[Attribute]) -> Result<()>
[src]
fn print_outer_attributes_inline(&mut self, attrs: &[Attribute]) -> Result<()>
[src]
fn print_either_attributes(
&mut self,
attrs: &[Attribute],
kind: AttrStyle,
is_inline: bool,
trailing_hardbreak: bool
) -> Result<()>
[src]
&mut self,
attrs: &[Attribute],
kind: AttrStyle,
is_inline: bool,
trailing_hardbreak: bool
) -> Result<()>
fn print_attribute_path(&mut self, path: &Path) -> Result<()>
[src]
fn print_attribute(&mut self, attr: &Attribute) -> Result<()>
[src]
fn print_attribute_inline(
&mut self,
attr: &Attribute,
is_inline: bool
) -> Result<()>
[src]
&mut self,
attr: &Attribute,
is_inline: bool
) -> Result<()>