Trait rustc_middle::ty::print::Printer

source ·
pub trait Printer<'tcx>: Sized {
Show 14 methods // Required methods fn tcx<'a>(&'a self) -> TyCtxt<'tcx>; fn print_region(&mut self, region: Region<'tcx>) -> Result<(), PrintError>; fn print_type(&mut self, ty: Ty<'tcx>) -> Result<(), PrintError>; fn print_dyn_existential( &mut self, predicates: &'tcx List<PolyExistentialPredicate<'tcx>>, ) -> Result<(), PrintError>; fn print_const(&mut self, ct: Const<'tcx>) -> Result<(), PrintError>; fn path_crate(&mut self, cnum: CrateNum) -> Result<(), PrintError>; fn path_qualified( &mut self, self_ty: Ty<'tcx>, trait_ref: Option<TraitRef<'tcx>>, ) -> Result<(), PrintError>; fn path_append_impl( &mut self, print_prefix: impl FnOnce(&mut Self) -> Result<(), PrintError>, disambiguated_data: &DisambiguatedDefPathData, self_ty: Ty<'tcx>, trait_ref: Option<TraitRef<'tcx>>, ) -> Result<(), PrintError>; fn path_append( &mut self, print_prefix: impl FnOnce(&mut Self) -> Result<(), PrintError>, disambiguated_data: &DisambiguatedDefPathData, ) -> Result<(), PrintError>; fn path_generic_args( &mut self, print_prefix: impl FnOnce(&mut Self) -> Result<(), PrintError>, args: &[GenericArg<'tcx>], ) -> Result<(), PrintError>; // Provided methods fn print_def_path( &mut self, def_id: DefId, args: &'tcx [GenericArg<'tcx>], ) -> Result<(), PrintError> { ... } fn print_impl_path( &mut self, impl_def_id: DefId, args: &'tcx [GenericArg<'tcx>], self_ty: Ty<'tcx>, trait_ref: Option<TraitRef<'tcx>>, ) -> Result<(), PrintError> { ... } fn default_print_def_path( &mut self, def_id: DefId, args: &'tcx [GenericArg<'tcx>], ) -> Result<(), PrintError> { ... } fn default_print_impl_path( &mut self, impl_def_id: DefId, _args: &'tcx [GenericArg<'tcx>], self_ty: Ty<'tcx>, impl_trait_ref: Option<TraitRef<'tcx>>, ) -> Result<(), PrintError> { ... }
}
Expand description

Interface for outputting user-facing “type-system entities” (paths, types, lifetimes, constants, etc.) as a side-effect (e.g. formatting, like PrettyPrinter implementors do) or by constructing some alternative representation (e.g. an AST), which the associated types allow passing through the methods.

For pretty-printing/formatting in particular, see PrettyPrinter.

Required Methods§

source

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

source

fn print_region(&mut self, region: Region<'tcx>) -> Result<(), PrintError>

source

fn print_type(&mut self, ty: Ty<'tcx>) -> Result<(), PrintError>

source

fn print_dyn_existential( &mut self, predicates: &'tcx List<PolyExistentialPredicate<'tcx>>, ) -> Result<(), PrintError>

source

fn print_const(&mut self, ct: Const<'tcx>) -> Result<(), PrintError>

source

fn path_crate(&mut self, cnum: CrateNum) -> Result<(), PrintError>

source

fn path_qualified( &mut self, self_ty: Ty<'tcx>, trait_ref: Option<TraitRef<'tcx>>, ) -> Result<(), PrintError>

source

fn path_append_impl( &mut self, print_prefix: impl FnOnce(&mut Self) -> Result<(), PrintError>, disambiguated_data: &DisambiguatedDefPathData, self_ty: Ty<'tcx>, trait_ref: Option<TraitRef<'tcx>>, ) -> Result<(), PrintError>

source

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

source

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

Provided Methods§

source

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

source

fn print_impl_path( &mut self, impl_def_id: DefId, args: &'tcx [GenericArg<'tcx>], self_ty: Ty<'tcx>, trait_ref: Option<TraitRef<'tcx>>, ) -> Result<(), PrintError>

source

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

source

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

Object Safety§

This trait is not object safe.

Implementors§

source§

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