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

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

Width of lines we're constrained to

space: isize

Number of spaces left on line

left: usize

Index of left side of input stream

right: usize

Index of right side of input stream

buf: Vec<BufEntry>

Ring-buffer of tokens and calculated sizes

left_total: isize

Running size of stream "...left"

right_total: isize

Running size of stream "...right"

scan_stack: VecDeque<usize>

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>

Stack of blocks-in-progress being flushed by print

pending_indentation: isize

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!

pub(in pp) fn scan_eof(
    &mut self
)
[src]

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

pub(in pp) fn scan_end(
    &mut self
)
[src]

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

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

pub(in pp) fn check_stream(
    &mut self
)
[src]

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

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

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

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

pub(in pp) fn advance_right(
    &mut self
)
[src]

pub(in pp) fn advance_left(
    &mut self
)
[src]

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

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

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

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

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

pub(in pp) fn print_end(
    &mut self
)
[src]

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

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

pub(in pp) 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]

pub(in pp) 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]

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

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

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

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

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.

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.