struct SymbolMangler<'tcx> {
    tcx: TyCtxt<'tcx>,
    binders: Vec<BinderLevel>,
    out: String,
    start_offset: usize,
    paths: FxHashMap<(DefId, &'tcx [GenericArg<'tcx>]), usize>,
    types: FxHashMap<Ty<'tcx>, usize>,
    consts: FxHashMap<Const<'tcx>, usize>,
}

Fields§

§tcx: TyCtxt<'tcx>§binders: Vec<BinderLevel>§out: String§start_offset: usize

The length of the prefix in out (e.g. 2 for _R).

§paths: FxHashMap<(DefId, &'tcx [GenericArg<'tcx>]), usize>

The values are start positions in out, in bytes.

§types: FxHashMap<Ty<'tcx>, usize>§consts: FxHashMap<Const<'tcx>, usize>

Implementations§

source§

impl<'tcx> SymbolMangler<'tcx>

source

fn push(&mut self, s: &str)

source

fn push_integer_62(&mut self, x: u64)

Push a _-terminated base 62 integer, using the format specified in the RFC as <base-62-number>, that is:

  • x = 0 is encoded as just the "_" terminator
  • x > 0 is encoded as x - 1 in base 62, followed by "_", e.g. 1 becomes "0_", 62 becomes "Z_", etc.
source

fn push_opt_integer_62(&mut self, tag: &str, x: u64)

Push a tag-prefixed base 62 integer, when larger than 0, that is:

  • x = 0 is encoded as "" (nothing)
  • x > 0 is encoded as the tag followed by push_integer_62(x - 1) e.g. 1 becomes tag + "_", 2 becomes tag + "0_", etc.
source

fn push_disambiguator(&mut self, dis: u64)

source

fn push_ident(&mut self, ident: &str)

source

fn path_append_ns<'a>( &'a mut self, print_prefix: impl FnOnce(&'a mut Self) -> Result<&'a mut Self, !>, ns: char, disambiguator: u64, name: &str ) -> Result<&'a mut Self, !>

source

fn print_backref(&mut self, i: usize) -> Result<&mut Self, !>

source

fn in_binder<'a, T>( &'a mut self, value: &Binder<'tcx, T>, print_value: impl FnOnce(&'a mut Self, &T) -> Result<&'a mut Self, !> ) -> Result<&'a mut Self, !>where T: TypeVisitable<TyCtxt<'tcx>>,

Trait Implementations§

source§

impl<'tcx> Printer<'tcx> for &mut SymbolMangler<'tcx>

§

type Error = !

§

type Path = &mut SymbolMangler<'tcx>

§

type Region = &mut SymbolMangler<'tcx>

§

type Type = &mut SymbolMangler<'tcx>

§

type DynExistential = &mut SymbolMangler<'tcx>

§

type Const = &mut SymbolMangler<'tcx>

source§

fn tcx(&self) -> TyCtxt<'tcx>

source§

fn print_def_path( self, def_id: DefId, args: &'tcx [GenericArg<'tcx>] ) -> Result<Self::Path, Self::Error>

source§

fn print_impl_path( self, impl_def_id: DefId, args: &'tcx [GenericArg<'tcx>], self_ty: Ty<'tcx>, impl_trait_ref: Option<TraitRef<'tcx>> ) -> Result<Self::Path, Self::Error>

source§

fn print_region(self, region: Region<'_>) -> Result<Self::Region, Self::Error>

source§

fn print_type(self, ty: Ty<'tcx>) -> Result<Self::Type, Self::Error>

source§

fn print_dyn_existential( self, predicates: &'tcx List<PolyExistentialPredicate<'tcx>> ) -> Result<Self::DynExistential, Self::Error>

source§

fn print_const(self, ct: Const<'tcx>) -> Result<Self::Const, Self::Error>

source§

fn path_crate(self, cnum: CrateNum) -> Result<Self::Path, Self::Error>

source§

fn path_qualified( self, self_ty: Ty<'tcx>, trait_ref: Option<TraitRef<'tcx>> ) -> Result<Self::Path, Self::Error>

source§

fn path_append_impl( self, _: impl FnOnce(Self) -> Result<Self::Path, Self::Error>, _: &DisambiguatedDefPathData, _: Ty<'tcx>, _: Option<TraitRef<'tcx>> ) -> Result<Self::Path, Self::Error>

source§

fn path_append( self, print_prefix: impl FnOnce(Self) -> Result<Self::Path, Self::Error>, disambiguated_data: &DisambiguatedDefPathData ) -> Result<Self::Path, Self::Error>

source§

fn path_generic_args( self, print_prefix: impl FnOnce(Self) -> Result<Self::Path, Self::Error>, args: &[GenericArg<'tcx>] ) -> Result<Self::Path, Self::Error>

source§

fn default_print_def_path( self, def_id: DefId, args: &'tcx [GenericArg<'tcx>] ) -> Result<Self::Path, Self::Error>

source§

fn default_print_impl_path( self, impl_def_id: DefId, _args: &'tcx [GenericArg<'tcx>], self_ty: Ty<'tcx>, impl_trait_ref: Option<TraitRef<'tcx>> ) -> Result<Self::Path, Self::Error>

Auto Trait Implementations§

§

impl<'tcx> !RefUnwindSafe for SymbolMangler<'tcx>

§

impl<'tcx> !Send for SymbolMangler<'tcx>

§

impl<'tcx> !Sync for SymbolMangler<'tcx>

§

impl<'tcx> Unpin for SymbolMangler<'tcx>

§

impl<'tcx> !UnwindSafe for SymbolMangler<'tcx>

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.

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 160 bytes