pub struct Function { /* private fields */ }
Implementations§
source§impl Function
impl Function
pub fn module(self, db: &dyn HirDatabase) -> Module
pub fn name(self, db: &dyn HirDatabase) -> Name
sourcepub fn ret_type(self, db: &dyn HirDatabase) -> Type
pub fn ret_type(self, db: &dyn HirDatabase) -> Type
Get this function’s return type
pub fn async_ret_type(self, db: &dyn HirDatabase) -> Option<Type>
pub fn has_self_param(self, db: &dyn HirDatabase) -> bool
pub fn self_param(self, db: &dyn HirDatabase) -> Option<SelfParam>
pub fn assoc_fn_params(self, db: &dyn HirDatabase) -> Vec<Param>
pub fn method_params(self, db: &dyn HirDatabase) -> Option<Vec<Param>>
pub fn params_without_self(self, db: &dyn HirDatabase) -> Vec<Param>
pub fn is_const(self, db: &dyn HirDatabase) -> bool
pub fn is_async(self, db: &dyn HirDatabase) -> bool
pub fn is_unsafe_to_call(self, db: &dyn HirDatabase) -> bool
sourcepub fn has_body(self, db: &dyn HirDatabase) -> bool
pub fn has_body(self, db: &dyn HirDatabase) -> bool
Whether this function declaration has a definition.
This is false in the case of required (not provided) trait methods.
pub fn as_proc_macro(self, db: &dyn HirDatabase) -> Option<Macro>
Trait Implementations§
source§impl AsAssocItem for Function
impl AsAssocItem for Function
fn as_assoc_item(self, db: &dyn HirDatabase) -> Option<AssocItem>
source§impl From<Function> for DefWithBody
impl From<Function> for DefWithBody
source§fn from(it: Function) -> DefWithBody
fn from(it: Function) -> DefWithBody
Converts to this type from the input type.
source§impl From<Function> for FunctionId
impl From<Function> for FunctionId
source§fn from(ty: Function) -> FunctionId
fn from(ty: Function) -> FunctionId
Converts to this type from the input type.
source§impl From<Function> for GenericDef
impl From<Function> for GenericDef
source§fn from(it: Function) -> GenericDef
fn from(it: Function) -> GenericDef
Converts to this type from the input type.
source§impl From<FunctionId> for Function
impl From<FunctionId> for Function
source§fn from(id: FunctionId) -> Function
fn from(id: FunctionId) -> Function
Converts to this type from the input type.
source§impl HasAttrs for Function
impl HasAttrs for Function
fn attrs(self, db: &dyn HirDatabase) -> AttrsWithOwner
fn docs(self, db: &dyn HirDatabase) -> Option<Documentation>
fn resolve_doc_path(
self,
db: &dyn HirDatabase,
link: &str,
ns: Option<Namespace>
) -> Option<ModuleDef>
source§impl HasSource for Function
impl HasSource for Function
type Ast = Fn
source§fn source(self, db: &dyn HirDatabase) -> Option<InFile<Self::Ast>>
fn source(self, db: &dyn HirDatabase) -> Option<InFile<Self::Ast>>
Fetches the definition’s source node.
Using
crate::Semantics::source
is preferred when working with crate::Semantics
,
as that caches the parsed file in the semantics’ cache.source§impl HasVisibility for Function
impl HasVisibility for Function
fn visibility(&self, db: &dyn HirDatabase) -> Visibility
fn is_visible_from(&self, db: &dyn HirDatabase, module: Module) -> bool
source§impl HirDisplay for Function
impl HirDisplay for Function
fn hir_fmt(&self, f: &mut HirFormatter<'_>) -> Result<(), HirDisplayError>
source§fn into_displayable<'a>(
&'a self,
db: &'a (dyn HirDatabase + 'a),
max_size: Option<usize>,
omit_verbose_types: bool,
display_target: DisplayTarget
) -> HirDisplayWrapper<'a, Self>where
Self: Sized,
fn into_displayable<'a>(
&'a self,
db: &'a (dyn HirDatabase + 'a),
max_size: Option<usize>,
omit_verbose_types: bool,
display_target: DisplayTarget
) -> 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 + 'a)
) -> HirDisplayWrapper<'a, Self>where
Self: Sized,
fn display<'a>(
&'a self,
db: &'a (dyn HirDatabase + 'a)
) -> 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 + 'a),
max_size: Option<usize>
) -> HirDisplayWrapper<'a, Self>where
Self: Sized,
fn display_truncated<'a>(
&'a self,
db: &'a (dyn HirDatabase + 'a),
max_size: Option<usize>
) -> 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_source_code<'a>(
&'a self,
db: &'a (dyn HirDatabase + 'a),
module_id: ModuleId
) -> Result<String, DisplaySourceCodeError>
fn display_source_code<'a>(
&'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)source§fn display_test<'a>(
&'a self,
db: &'a (dyn HirDatabase + 'a)
) -> HirDisplayWrapper<'a, Self>where
Self: Sized,
fn display_test<'a>(
&'a self,
db: &'a (dyn HirDatabase + 'a)
) -> HirDisplayWrapper<'a, Self>where
Self: Sized,
Returns a String representation of
self
for test purposessource§impl PartialEq<Function> for Function
impl PartialEq<Function> for Function
impl Copy for Function
impl Eq for Function
impl StructuralEq for Function
impl StructuralPartialEq for Function
Auto Trait Implementations§
impl RefUnwindSafe for Function
impl Send for Function
impl Sync for Function
impl Unpin for Function
impl UnwindSafe for Function
Blanket Implementations§
§impl<T> Cast for T
impl<T> Cast for T
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.