Struct ra_ap_hir::Type [−][src]
pub struct Type { /* fields omitted */ }
Implementations
Checks that particular type ty
implements std::future::Future
.
This function is used in .await
syntax completion.
Checks that particular type ty
implements std::ops::FnOnce
.
This function can be used to check if a particular type is callable, since FnOnce is a supertrait of Fn and FnMut, so all callable types implements at least FnOnce.
pub fn normalize_trait_assoc_type(
&self,
db: &dyn HirDatabase,
args: &[Type],
alias: TypeAlias
) -> Option<Type>
pub fn iterate_assoc_items<T>(
self,
db: &dyn HirDatabase,
krate: Crate,
callback: impl FnMut(AssocItem) -> Option<T>
) -> Option<T>
pub fn iterate_method_candidates<T>(
&self,
db: &dyn HirDatabase,
krate: Crate,
traits_in_scope: &FxHashSet<TraitId>,
name: Option<&Name>,
callback: impl FnMut(Type, Function) -> Option<T>
) -> Option<T>
pub fn iterate_path_candidates<T>(
&self,
db: &dyn HirDatabase,
krate: Crate,
traits_in_scope: &FxHashSet<TraitId>,
name: Option<&Name>,
callback: impl FnMut(Type, AssocItem) -> Option<T>
) -> Option<T>
pub fn applicable_inherent_traits<'a>(
&'a self,
db: &'a dyn HirDatabase
) -> impl Iterator<Item = Trait> + 'a
pub fn applicable_inherent_traits<'a>(
&'a self,
db: &'a dyn HirDatabase
) -> impl Iterator<Item = Trait> + 'a
If a type can be represented as dyn Trait
, returns all traits accessible via this type,
or an empty iterator otherwise.
Trait Implementations
fn into_displayable(
&'a self,
db: &'a (dyn HirDatabase + 'a),
max_size: Option<usize>,
omit_verbose_types: bool,
display_target: DisplayTarget
) -> HirDisplayWrapper<'a, Self>
fn into_displayable(
&'a self,
db: &'a (dyn HirDatabase + 'a),
max_size: Option<usize>,
omit_verbose_types: bool,
display_target: DisplayTarget
) -> HirDisplayWrapper<'a, Self>
Returns a Display
able type that is human-readable.
Returns a Display
able type that is human-readable.
Use this for showing types to the user (e.g. diagnostics) Read more
fn display_truncated(
&'a self,
db: &'a (dyn HirDatabase + 'a),
max_size: Option<usize>
) -> HirDisplayWrapper<'a, Self>
fn display_truncated(
&'a self,
db: &'a (dyn HirDatabase + 'a),
max_size: Option<usize>
) -> HirDisplayWrapper<'a, Self>
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) Read more
fn display_source_code(
&'a self,
db: &'a (dyn HirDatabase + 'a),
module_id: ModuleId
) -> Result<String, DisplaySourceCodeError>
fn display_source_code(
&'a self,
db: &'a (dyn HirDatabase + 'a),
module_id: ModuleId
) -> 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) Read more
Returns a String representation of self
for test purposes
Auto Trait Implementations
impl RefUnwindSafe for Type
impl UnwindSafe for Type
Blanket Implementations
Mutably borrows from an owned value. Read more
fn cast<U>(self, interner: &<U as HasInterner>::Interner) -> U where
Self: CastTo<U>,
U: HasInterner,
fn cast<U>(self, interner: &<U as HasInterner>::Interner) -> U where
Self: CastTo<U>,
U: HasInterner,
Cast a value to type U
using CastTo
.
Compare self to key
and return true
if they are equal.
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more