pub type Ty = Ty<Interner>;
Aliased Type§
struct Ty { /* private fields */ }
Trait Implementations§
source§impl HirDisplay for Ty
impl HirDisplay for Ty
fn hir_fmt(&self, f: &mut HirFormatter<'_>) -> Result<(), HirDisplayError>
source§fn into_displayable<'a>(
&'a self,
db: &'a dyn HirDatabase,
max_size: Option<usize>,
limited_size: Option<usize>,
omit_verbose_types: bool,
display_target: DisplayTarget,
closure_style: ClosureStyle,
show_container_bounds: bool,
) -> HirDisplayWrapper<'a, Self>where
Self: Sized,
fn into_displayable<'a>(
&'a self,
db: &'a dyn HirDatabase,
max_size: Option<usize>,
limited_size: Option<usize>,
omit_verbose_types: bool,
display_target: DisplayTarget,
closure_style: ClosureStyle,
show_container_bounds: bool,
) -> HirDisplayWrapper<'a, Self>where
Self: Sized,
Returns a
Display
able type that is human-readable.source§fn display<'a>(
&'a self,
db: &'a dyn HirDatabase,
edition: Edition,
) -> HirDisplayWrapper<'a, Self>where
Self: Sized,
fn display<'a>(
&'a self,
db: &'a dyn HirDatabase,
edition: Edition,
) -> HirDisplayWrapper<'a, Self>where
Self: Sized,
Returns a
Display
able type that is human-readable.
Use this for showing types to the user (e.g. diagnostics)source§fn display_truncated<'a>(
&'a self,
db: &'a dyn HirDatabase,
max_size: Option<usize>,
edition: Edition,
) -> HirDisplayWrapper<'a, Self>where
Self: Sized,
fn display_truncated<'a>(
&'a self,
db: &'a dyn HirDatabase,
max_size: Option<usize>,
edition: Edition,
) -> HirDisplayWrapper<'a, Self>where
Self: Sized,
Returns a
Display
able type that is human-readable and tries to be succinct.
Use this for showing types to the user where space is constrained (e.g. doc popups)source§fn display_limited<'a>(
&'a self,
db: &'a dyn HirDatabase,
limited_size: Option<usize>,
edition: Edition,
) -> HirDisplayWrapper<'a, Self>where
Self: Sized,
fn display_limited<'a>(
&'a self,
db: &'a dyn HirDatabase,
limited_size: Option<usize>,
edition: Edition,
) -> HirDisplayWrapper<'a, Self>where
Self: Sized,
Returns a
Display
able type that is human-readable and tries to limit the number of items inside.
Use this for showing definitions which may contain too many items, like trait
, struct
, enum
source§fn display_source_code<'a>(
&'a self,
db: &'a dyn HirDatabase,
module_id: ModuleId,
allow_opaque: bool,
) -> Result<String, DisplaySourceCodeError>
fn display_source_code<'a>( &'a self, db: &'a dyn HirDatabase, module_id: ModuleId, allow_opaque: bool, ) -> Result<String, DisplaySourceCodeError>
Returns a String representation of
self
that can be inserted into the given module.
Use this when generating code (e.g. assists)source§fn display_test<'a>(
&'a self,
db: &'a dyn HirDatabase,
) -> HirDisplayWrapper<'a, Self>where
Self: Sized,
fn display_test<'a>(
&'a self,
db: &'a dyn HirDatabase,
) -> HirDisplayWrapper<'a, Self>where
Self: Sized,
Returns a String representation of
self
for test purposessource§fn display_with_container_bounds<'a>(
&'a self,
db: &'a dyn HirDatabase,
show_container_bounds: bool,
edition: Edition,
) -> HirDisplayWrapper<'a, Self>where
Self: Sized,
fn display_with_container_bounds<'a>(
&'a self,
db: &'a dyn HirDatabase,
show_container_bounds: bool,
edition: Edition,
) -> HirDisplayWrapper<'a, Self>where
Self: Sized,
Returns a String representation of
self
that shows the constraint from
the container for functionssource§impl TyExt for Ty
impl TyExt for Ty
fn is_unit(&self) -> bool
fn is_integral(&self) -> bool
fn is_scalar(&self) -> bool
fn is_floating_point(&self) -> bool
fn is_never(&self) -> bool
fn is_str(&self) -> bool
fn is_unknown(&self) -> bool
fn contains_unknown(&self) -> bool
fn is_ty_var(&self) -> bool
fn is_union(&self) -> bool
fn as_adt(&self) -> Option<(AdtId, &Substitution)>
fn as_builtin(&self) -> Option<BuiltinType>
fn as_tuple(&self) -> Option<&Substitution>
fn as_closure(&self) -> Option<ClosureId>
fn as_fn_def(&self, db: &dyn HirDatabase) -> Option<FunctionId>
fn as_reference(&self) -> Option<(&Ty, Lifetime, Mutability)>
fn as_raw_ptr(&self) -> Option<(&Ty, Mutability)>
fn as_reference_or_ptr(&self) -> Option<(&Ty, Rawness, Mutability)>
fn as_generic_def(&self, db: &dyn HirDatabase) -> Option<GenericDefId>
fn callable_def(&self, db: &dyn HirDatabase) -> Option<CallableDefId>
fn callable_sig(&self, db: &dyn HirDatabase) -> Option<CallableSig>
fn strip_references(&self) -> &Ty
fn strip_reference(&self) -> &Ty
fn impl_trait_bounds( &self, db: &dyn HirDatabase, ) -> Option<Vec<QuantifiedWhereClause>>
fn associated_type_parent_trait(&self, db: &dyn HirDatabase) -> Option<TraitId>
fn is_copy(self, db: &dyn HirDatabase, owner: DefWithBodyId) -> bool
source§fn equals_ctor(&self, other: &Ty) -> bool
fn equals_ctor(&self, other: &Ty) -> bool
FIXME: Get rid of this, it’s not a good abstraction