Struct syntex_syntax::print::pprust::State
[−]
[src]
pub struct State<'a> { pub s: Printer<'a>, // some fields omitted }
Fields
s |
Methods
impl<'a> State<'a>
[src]
fn new_from_input(cm: &'a CodeMap, span_diagnostic: &SpanHandler, filename: String, input: &mut Read, out: Box<Write + 'a>, ann: &'a PpAnn, is_expanded: bool) -> State<'a>
fn new(cm: &'a CodeMap, out: Box<Write + 'a>, ann: &'a PpAnn, comments: Option<Vec<Comment>>, literals: Option<Vec<Literal>>) -> State<'a>
impl<'a> State<'a>
[src]
fn cbox(&mut self, u: usize) -> Result<()>
fn word_nbsp(&mut self, w: &str) -> Result<()>
fn head(&mut self, w: &str) -> Result<()>
fn bopen(&mut self) -> Result<()>
fn bclose_(&mut self, span: Span, indented: usize) -> Result<()>
fn bclose_maybe_open(&mut self, span: Span, indented: usize, close_box: bool) -> Result<()>
fn bclose(&mut self, span: Span) -> Result<()>
fn in_cbox(&self) -> bool
fn break_offset_if_not_bol(&mut self, n: usize, off: isize) -> Result<()>
fn synth_comment(&mut self, text: String) -> Result<()>
fn commasep_cmnt<T, F, G>(&mut self, b: Breaks, elts: &[T], op: F, get_span: G) -> Result<()> where F: FnMut(&mut State, &T) -> Result<()>, G: FnMut(&T) -> Span
fn commasep_exprs(&mut self, b: Breaks, exprs: &[P<Expr>]) -> Result<()>
fn print_mod(&mut self, _mod: &Mod, attrs: &[Attribute]) -> Result<()>
fn print_foreign_mod(&mut self, nmod: &ForeignMod, attrs: &[Attribute]) -> Result<()>
fn print_opt_lifetime(&mut self, lifetime: &Option<Lifetime>) -> Result<()>
fn print_type(&mut self, ty: &Ty) -> Result<()>
fn print_foreign_item(&mut self, item: &ForeignItem) -> Result<()>
fn print_item(&mut self, item: &Item) -> Result<()>
Pretty-print an item
fn print_enum_def(&mut self, enum_definition: &EnumDef, generics: &Generics, ident: Ident, span: Span, visibility: Visibility) -> Result<()>
fn print_variants(&mut self, variants: &[P<Variant>], span: Span) -> Result<()>
fn print_visibility(&mut self, vis: Visibility) -> Result<()>
fn print_struct(&mut self, struct_def: &VariantData, generics: &Generics, ident: Ident, span: Span, print_finalizer: bool) -> 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.