@@ -40,8 +40,8 @@ use crate::{
4040 source_analyzer:: { resolve_hir_path, SourceAnalyzer } ,
4141 Access , Adjust , Adjustment , AutoBorrow , BindingMode , BuiltinAttr , Callable , ConstParam , Crate ,
4242 DeriveHelper , Field , Function , HasSource , HirFileId , Impl , InFile , Label , LifetimeParam , Local ,
43- Macro , Module , ModuleDef , Name , OverloadedDeref , Path , ScopeDef , ToolModule , Trait , Type ,
44- TypeAlias , TypeParam , VariantDef ,
43+ Macro , Module , ModuleDef , Name , OverloadedDeref , Path , ScopeDef , Struct , ToolModule , Trait ,
44+ Type , TypeAlias , TypeParam , VariantDef ,
4545} ;
4646
4747pub enum DescendPreference {
@@ -229,6 +229,14 @@ impl<'db, DB: HirDatabase> Semantics<'db, DB> {
229229 pub fn to_module_defs ( & self , file : FileId ) -> impl Iterator < Item = Module > {
230230 self . imp . to_module_def ( file)
231231 }
232+
233+ pub fn to_struct_def ( & self , s : & ast:: Struct ) -> Option < Struct > {
234+ self . imp . to_def ( s) . map ( Struct :: from)
235+ }
236+
237+ pub fn to_impl_def ( & self , i : & ast:: Impl ) -> Option < Impl > {
238+ self . imp . to_def ( i) . map ( Impl :: from)
239+ }
232240}
233241
234242impl < ' db > SemanticsImpl < ' db > {
0 commit comments