pub struct FmtPrinter<'a, 'tcx>(Box<FmtPrinterData<'a, 'tcx>>);

Tuple Fields§

§0: Box<FmtPrinterData<'a, 'tcx>>

Implementations§

source§

impl<'a, 'tcx> FmtPrinter<'a, 'tcx>

source

pub fn new(tcx: TyCtxt<'tcx>, ns: Namespace) -> Self

source

pub fn new_with_limit( tcx: TyCtxt<'tcx>, ns: Namespace, type_length_limit: Limit ) -> Self

source

pub fn into_buffer(self) -> String

source§

impl<'tcx> FmtPrinter<'_, 'tcx>

source

pub fn pretty_print_region(self, region: Region<'tcx>) -> Result<Self, Error>

source§

impl<'tcx> FmtPrinter<'_, 'tcx>

source

pub fn name_all_regions<T>( self, value: &Binder<'tcx, T> ) -> Result<(Self, T, BTreeMap<BoundRegion, Region<'tcx>>), Error>where T: Print<'tcx, Self, Output = Self, Error = Error> + TypeFoldable<TyCtxt<'tcx>>,

source

pub fn pretty_in_binder<T>(self, value: &Binder<'tcx, T>) -> Result<Self, Error>where T: Print<'tcx, Self, Output = Self, Error = Error> + TypeFoldable<TyCtxt<'tcx>>,

source

pub fn pretty_wrap_binder<T, C: FnOnce(&T, Self) -> Result<Self, Error>>( self, value: &Binder<'tcx, T>, f: C ) -> Result<Self, Error>where T: Print<'tcx, Self, Output = Self, Error = Error> + TypeFoldable<TyCtxt<'tcx>>,

source

fn prepare_region_info<T>(&mut self, value: &Binder<'tcx, T>)where T: TypeVisitable<TyCtxt<'tcx>>,

Trait Implementations§

source§

impl<'a, 'tcx> Deref for FmtPrinter<'a, 'tcx>

§

type Target = FmtPrinterData<'a, 'tcx>

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl DerefMut for FmtPrinter<'_, '_>

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
source§

impl<'tcx> PrettyPrinter<'tcx> for FmtPrinter<'_, 'tcx>

source§

fn ty_infer_name(&self, id: TyVid) -> Option<Symbol>

source§

fn reset_type_limit(&mut self)

source§

fn const_infer_name(&self, id: ConstVid<'tcx>) -> Option<Symbol>

source§

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

Like print_def_path but for value paths.
source§

fn in_binder<T>(self, value: &Binder<'tcx, T>) -> Result<Self, Self::Error>where T: Print<'tcx, Self, Output = Self, Error = Self::Error> + TypeFoldable<TyCtxt<'tcx>>,

source§

fn wrap_binder<T, C: FnOnce(&T, Self) -> Result<Self, Self::Error>>( self, value: &Binder<'tcx, T>, f: C ) -> Result<Self, Self::Error>where T: Print<'tcx, Self, Output = Self, Error = Self::Error> + TypeFoldable<TyCtxt<'tcx>>,

source§

fn typed_value( self, f: impl FnOnce(Self) -> Result<Self, Self::Error>, t: impl FnOnce(Self) -> Result<Self, Self::Error>, conversion: &str ) -> Result<Self::Const, Self::Error>

Prints {f: t} or {f as t} depending on the cast argument
source§

fn generic_delimiters( self, f: impl FnOnce(Self) -> Result<Self, Self::Error> ) -> Result<Self, Self::Error>

Prints <...> around what f prints.
source§

fn should_print_region(&self, region: Region<'tcx>) -> bool

Returns true if the region should be printed in optional positions, e.g., &'a T or dyn Tr + 'b. This is typically the case for all non-'_ regions.
source§

fn pretty_print_const_pointer<Prov: Provenance>( self, p: Pointer<Prov>, ty: Ty<'tcx> ) -> Result<Self::Const, Self::Error>

This is overridden for MIR printing because we only want to hide alloc ids from users, not from MIR where it is actually useful.
source§

fn comma_sep<T>( self, elems: impl Iterator<Item = T> ) -> Result<Self, Self::Error>where T: Print<'tcx, Self, Output = Self, Error = Self::Error>,

Prints comma-separated elements.
source§

fn try_print_visible_def_path( self, def_id: DefId ) -> Result<(Self, bool), Self::Error>

If possible, this returns a global path resolving to def_id that is visible from at least one local module, and returns true. If the crate defining def_id is declared with an extern crate, the path is guaranteed to use the extern crate.
source§

fn force_print_trimmed_def_path( self, def_id: DefId ) -> Result<(Self::Path, bool), Self::Error>

source§

fn try_print_trimmed_def_path( self, def_id: DefId ) -> Result<(Self::Path, bool), Self::Error>

Try to see if this path can be trimmed to a unique symbol name.
source§

fn try_print_visible_def_path_recur( self, def_id: DefId, callers: &mut Vec<DefId> ) -> Result<(Self, bool), Self::Error>

Does the work of try_print_visible_def_path, building the full definition path recursively before attempting to post-process it into the valid and visible version that accounts for re-exports. Read more
source§

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

source§

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

source§

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

source§

fn pretty_print_opaque_impl_type( self, def_id: DefId, args: &'tcx List<GenericArg<'tcx>> ) -> Result<Self::Type, Self::Error>

source§

fn insert_trait_and_projection( &mut self, trait_ref: PolyTraitRef<'tcx>, proj_ty: Option<(DefId, Binder<'tcx, Term<'tcx>>)>, traits: &mut FxIndexMap<PolyTraitRef<'tcx>, FxIndexMap<DefId, Binder<'tcx, Term<'tcx>>>>, fn_traits: &mut FxIndexMap<PolyTraitRef<'tcx>, OpaqueFnEntry<'tcx>> )

Insert the trait ref and optionally a projection type associated with it into either the traits map or fn_traits map, depending on if the trait is in the Fn* family of traits.
source§

fn pretty_print_inherent_projection( self, alias_ty: &AliasTy<'tcx> ) -> Result<Self::Path, Self::Error>

source§

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

source§

fn pretty_fn_sig( self, inputs: &[Ty<'tcx>], c_variadic: bool, output: Ty<'tcx> ) -> Result<Self, Self::Error>

source§

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

source§

fn pretty_print_const_scalar( self, scalar: Scalar, ty: Ty<'tcx> ) -> Result<Self::Const, Self::Error>

source§

fn pretty_print_const_scalar_ptr( self, ptr: Pointer, ty: Ty<'tcx> ) -> Result<Self::Const, Self::Error>

source§

fn pretty_print_const_scalar_int( self, int: ScalarInt, ty: Ty<'tcx>, print_ty: bool ) -> Result<Self::Const, Self::Error>

source§

fn pretty_print_byte_str( self, byte_str: &'tcx [u8] ) -> Result<Self::Const, Self::Error>

source§

fn pretty_print_const_valtree( self, valtree: ValTree<'tcx>, ty: Ty<'tcx>, print_ty: bool ) -> Result<Self::Const, Self::Error>

source§

fn pretty_closure_as_impl( self, closure: ClosureArgs<'tcx> ) -> Result<Self::Const, Self::Error>

source§

fn should_print_verbose(&self) -> bool

source§

impl<'tcx> Printer<'tcx> for FmtPrinter<'_, 'tcx>

§

type Error = Error

§

type Path = FmtPrinter<'_, 'tcx>

§

type Region = FmtPrinter<'_, 'tcx>

§

type Type = FmtPrinter<'_, 'tcx>

§

type DynExistential = FmtPrinter<'_, 'tcx>

§

type Const = FmtPrinter<'_, 'tcx>

source§

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

source§

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

source§

fn print_region(self, region: Region<'tcx>) -> 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, print_prefix: impl FnOnce(Self) -> Result<Self::Path, Self::Error>, _disambiguated_data: &DisambiguatedDefPathData, self_ty: Ty<'tcx>, trait_ref: 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 print_impl_path( self, impl_def_id: DefId, args: &'tcx [GenericArg<'tcx>], self_ty: Ty<'tcx>, trait_ref: Option<TraitRef<'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>

source§

impl Write for FmtPrinter<'_, '_>

source§

fn write_str(&mut self, s: &str) -> Result

Writes a string slice into this writer, returning whether the write succeeded. Read more
1.1.0 · source§

fn write_char(&mut self, c: char) -> Result<(), Error>

Writes a char into this writer, returning whether the write succeeded. Read more
1.0.0 · source§

fn write_fmt(&mut self, args: Arguments<'_>) -> Result<(), Error>

Glue for usage of the write! macro with implementors of this trait. Read more

Auto Trait Implementations§

§

impl<'a, 'tcx> !RefUnwindSafe for FmtPrinter<'a, 'tcx>

§

impl<'a, 'tcx> !Send for FmtPrinter<'a, 'tcx>

§

impl<'a, 'tcx> !Sync for FmtPrinter<'a, 'tcx>

§

impl<'a, 'tcx> Unpin for FmtPrinter<'a, 'tcx>

§

impl<'a, 'tcx> !UnwindSafe for FmtPrinter<'a, 'tcx>

Blanket Implementations§

source§

impl<T> Aligned for T

source§

const ALIGN: Alignment = _

Alignment of Self.
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, R> CollectAndApply<T, R> for T

source§

fn collect_and_apply<I, F>(iter: I, f: F) -> Rwhere I: Iterator<Item = T>, F: FnOnce(&[T]) -> R,

Equivalent to f(&iter.collect::<Vec<_>>()).

§

type Output = R

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<P> IntoQueryParam<P> for P

source§

impl<T> MaybeResult<T> for T

§

type Error = !

source§

fn from(_: Result<T, <T as MaybeResult<T>>::Error>) -> T

source§

fn to_result(self) -> Result<T, <T as MaybeResult<T>>::Error>

source§

impl<'tcx, T> ToPredicate<'tcx, T> for T

source§

fn to_predicate(self, _tcx: TyCtxt<'tcx>) -> T

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.
source§

impl<Tcx, T> Value<Tcx> for Twhere Tcx: DepContext,

source§

default fn from_cycle_error( tcx: Tcx, cycle: &[QueryInfo], _guar: ErrorGuaranteed ) -> T

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: 8 bytes