Struct rustc_ast_pretty::pp::Printer[−][src]

pub struct Printer {
    out: String,
    buf_max_len: usize,
    margin: isize,
    space: isize,
    left: usize,
    right: usize,
    buf: Vec<BufEntry>,
    left_total: isize,
    right_total: isize,
    scan_stack: VecDeque<usize>,
    print_stack: Vec<PrintStackElem>,
    pending_indentation: isize,
}

Fields

out: Stringbuf_max_len: usizemargin: isize
Expand description

Width of lines we’re constrained to

space: isize
Expand description

Number of spaces left on line

left: usize
Expand description

Index of left side of input stream

right: usize
Expand description

Index of right side of input stream

buf: Vec<BufEntry>
Expand description

Ring-buffer of tokens and calculated sizes

left_total: isize
Expand description

Running size of stream “…left”

right_total: isize
Expand description

Running size of stream “…right”

scan_stack: VecDeque<usize>
Expand description

Pseudo-stack, really a ring too. Holds the primary-ring-buffers index of the Begin that started the current block, possibly with the most recent Break after that Begin (if there is any) on top of it. Stuff is flushed off the bottom as it becomes irrelevant due to the primary ring-buffer advancing.

print_stack: Vec<PrintStackElem>
Expand description

Stack of blocks-in-progress being flushed by print

pending_indentation: isize
Expand description

Buffered indentation to avoid writing trailing whitespace

Implementations

impl Printer[src]

pub fn word_space<W: Into<Cow<'static, str>>>(&mut self, w: W)[src]

pub fn popen(&mut self)[src]

pub fn pclose(&mut self)[src]

pub fn hardbreak_if_not_bol(&mut self)[src]

pub fn space_if_not_bol(&mut self)[src]

pub fn nbsp(&mut self)[src]

pub fn word_nbsp<S: Into<Cow<'static, str>>>(&mut self, w: S)[src]

impl Printer[src]

pub fn last_token(&self) -> Token[src]

pub fn replace_last_token(&mut self, t: Token)[src]

Be very careful with this!

fn scan_eof(&mut self)[src]

fn scan_begin(&mut self, b: BeginToken)[src]

fn scan_end(&mut self)[src]

fn scan_break(&mut self, b: BreakToken)[src]

fn scan_string(&mut self, s: Cow<'static, str>)[src]

fn check_stream(&mut self)[src]

fn scan_push(&mut self, entry: BufEntry)[src]

fn scan_pop(&mut self) -> usize[src]

fn scan_top(&self) -> usize[src]

fn scan_pop_bottom(&mut self) -> usize[src]

fn advance_right(&mut self)[src]

fn advance_left(&mut self)[src]

fn check_stack(&mut self, k: usize)[src]

fn print_newline(&mut self, amount: isize)[src]

fn indent(&mut self, amount: isize)[src]

fn get_top(&self) -> PrintStackElem[src]

fn print_begin(&mut self, b: BeginToken, l: isize)[src]

fn print_end(&mut self)[src]

fn print_break(&mut self, b: BreakToken, l: isize)[src]

fn print_string(&mut self, s: Cow<'static, str>)[src]

fn print(&mut self, token: Token, l: isize)[src]

pub fn rbox(&mut self, indent: usize, b: Breaks)[src]

“raw box”

pub fn ibox(&mut self, indent: usize)[src]

Inconsistent breaking box

pub fn cbox(&mut self, indent: usize)[src]

Consistent breaking box

pub fn break_offset(&mut self, n: usize, off: isize)[src]

pub fn end(&mut self)[src]

pub fn eof(self) -> String[src]

pub fn word<S: Into<Cow<'static, str>>>(&mut self, wrd: S)[src]

fn spaces(&mut self, n: usize)[src]

pub(crate) fn zerobreak(&mut self)[src]

pub fn space(&mut self)[src]

pub fn hardbreak(&mut self)[src]

pub fn is_beginning_of_line(&self) -> bool[src]

pub fn hardbreak_tok_offset(off: isize) -> Token[src]

Auto Trait Implementations

impl RefUnwindSafe for Printer

impl Send for Printer

impl Sync for Printer

impl Unpin for Printer

impl UnwindSafe for Printer

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized, 
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized, 
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized, 
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.