Trait syntax::print::pprust::PrintState
[−]
[src]
pub trait PrintState<'a> { 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; fn cur_lit(&mut self) -> Option<&Literal>; fn bump_lit(&mut self) -> Option<Literal>; fn word_space(&mut self, w: &str) -> 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<()>, { ... } fn next_lit(&mut self, pos: BytePos) -> Option<Literal> { ... } 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<()> { ... } 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<()> { ... } fn print_attribute(&mut self, attr: &Attribute) -> Result<()> { ... } fn print_attribute_inline(
&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<()> { ... } 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, ctxt: SyntaxContext) -> Result<()> { ... } }
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Required Methods
fn writer(&mut self) -> &mut Printer<'a>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn boxes(&mut self) -> &mut Vec<Breaks>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn comments(&mut self) -> &mut Option<Vec<Comment>>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn cur_cmnt(&mut self) -> &mut usize
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn cur_lit(&mut self) -> Option<&Literal>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn bump_lit(&mut self) -> Option<Literal>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Provided Methods
fn word_space(&mut self, w: &str) -> Result<()>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn popen(&mut self) -> Result<()>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn pclose(&mut self) -> Result<()>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn is_begin(&mut self) -> bool
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn is_end(&mut self) -> bool
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn is_bol(&mut self) -> bool
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn hardbreak_if_not_bol(&mut self) -> Result<()>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn rbox(&mut self, u: usize, b: Breaks) -> Result<()>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn ibox(&mut self, u: usize) -> Result<()>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn end(&mut self) -> Result<()>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
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<()>,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn next_lit(&mut self, pos: BytePos) -> Option<Literal>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn maybe_print_comment(&mut self, pos: BytePos) -> Result<()>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn print_comment(&mut self, cmnt: &Comment) -> Result<()>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn next_comment(&mut self) -> Option<Comment>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn print_literal(&mut self, lit: &Lit) -> Result<()>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn print_string(&mut self, st: &str, style: StrStyle) -> Result<()>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn print_inner_attributes(&mut self, attrs: &[Attribute]) -> Result<()>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn print_inner_attributes_no_trailing_hardbreak(
&mut self,
attrs: &[Attribute]
) -> Result<()>
&mut self,
attrs: &[Attribute]
) -> Result<()>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn print_outer_attributes(&mut self, attrs: &[Attribute]) -> Result<()>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn print_inner_attributes_inline(&mut self, attrs: &[Attribute]) -> Result<()>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn print_outer_attributes_inline(&mut self, attrs: &[Attribute]) -> Result<()>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
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<()>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn print_attribute(&mut self, attr: &Attribute) -> Result<()>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn print_attribute_inline(
&mut self,
attr: &Attribute,
is_inline: bool
) -> Result<()>
&mut self,
attr: &Attribute,
is_inline: bool
) -> Result<()>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn print_meta_list_item(&mut self, item: &NestedMetaItem) -> Result<()>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn print_meta_item(&mut self, item: &MetaItem) -> Result<()>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn print_tt(&mut self, tt: TokenTree) -> Result<()>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
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<()>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn space_if_not_bol(&mut self) -> Result<()>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn nbsp(&mut self) -> Result<()>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn print_dollar_crate(&mut self, ctxt: SyntaxContext) -> Result<()>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Implementors
impl<'a> PrintState<'a> for State<'a>