Struct rustc_demangle::v0::Printer

source ·
struct Printer<'a, 'b: 'a, 's> {
    parser: Result<Parser<'s>, ParseError>,
    out: Option<&'a mut Formatter<'b>>,
    bound_lifetime_depth: u32,
}

Fields§

§parser: Result<Parser<'s>, ParseError>

The input parser to demangle from, or Err if any (parse) error was encountered (in order to disallow further likely-incorrect demangling).

See also the documentation on the invalid! and parse! macros below.

§out: Option<&'a mut Formatter<'b>>

The output formatter to demangle to, or None while skipping printing.

§bound_lifetime_depth: u32

Cumulative number of lifetimes bound by for<...> binders (‘G’), anywhere “around” the current entity (e.g. type) being demangled. This value is not tracked while skipping printing, as it’d be unused.

See also the documentation on the Printer::in_binder method.

Implementations§

source§

impl<'a, 'b, 's> Printer<'a, 'b, 's>

source

fn eat(&mut self, b: u8) -> bool

Eat the given character from the parser, returning false if the parser errored.

source

fn skipping_printing<F>(&mut self, f: F)where F: FnOnce(&mut Self) -> Result,

Skip printing (i.e. self.out will be None) for the duration of the given closure. This should not change parsing behavior, only disable the output, but there may be optimizations (such as not traversing backrefs).

source

fn print_backref<F>(&mut self, f: F) -> Resultwhere F: FnOnce(&mut Self) -> Result,

Print the target of a backref, using the given closure. When printing is being skipped, the backref will only be parsed, ignoring the backref’s target completely.

source

fn pop_depth(&mut self)

source

fn print(&mut self, x: impl Display) -> Result

Output the given value to self.out (using fmt::Display formatting), if printing isn’t being skipped.

source

fn print_quoted_escaped_chars( &mut self, quote: char, chars: impl Iterator<Item = char> ) -> Result

Output the given chars (escaped using char::escape_debug), with the whole sequence wrapped in quotes, for either a char or &str literal, if printing isn’t being skipped.

source

fn print_lifetime_from_index(&mut self, lt: u64) -> Result

Print the lifetime according to the previously decoded index. An index of 0 always refers to '_, but starting with 1, indices refer to late-bound lifetimes introduced by a binder.

source

fn in_binder<F>(&mut self, f: F) -> Resultwhere F: FnOnce(&mut Self) -> Result,

Optionally enter a binder (‘G’) for late-bound lifetimes, printing e.g. for<'a, 'b> before calling the closure, and make those lifetimes visible to it (via depth level).

source

fn print_sep_list<F>(&mut self, f: F, sep: &str) -> Result<usize, Error>where F: Fn(&mut Self) -> Result,

Print list elements using the given closure and separator, until the end of the list (‘E’) is found, or the parser errors. Returns the number of elements printed.

source

fn print_path(&mut self, in_value: bool) -> Result

source

fn print_generic_arg(&mut self) -> Result

source

fn print_type(&mut self) -> Result

source

fn print_path_maybe_open_generics(&mut self) -> Result<bool, Error>

A trait in a trait object may have some “existential projections” (i.e. associated type bindings) after it, which should be printed in the <...> of the trait, e.g. dyn Trait<T, U, Assoc=X>. To this end, this method will keep the <...> of an ‘I’ path open, by omitting the >, and return Ok(true) in that case.

source

fn print_dyn_trait(&mut self) -> Result

source

fn print_const(&mut self, in_value: bool) -> Result

source

fn print_const_uint(&mut self, ty_tag: u8) -> Result

source

fn print_const_str_literal(&mut self) -> Result

Auto Trait Implementations§

§

impl<'a, 'b, 's> !RefUnwindSafe for Printer<'a, 'b, 's>

§

impl<'a, 'b, 's> !Send for Printer<'a, 'b, 's>

§

impl<'a, 'b, 's> !Sync for Printer<'a, 'b, 's>

§

impl<'a, 'b, 's> Unpin for Printer<'a, 'b, 's>

§

impl<'a, 'b, 's> !UnwindSafe for Printer<'a, 'b, 's>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.