@@ -40,8 +40,8 @@ use crate::{
40
40
source_analyzer:: { resolve_hir_path, SourceAnalyzer } ,
41
41
Access , Adjust , Adjustment , AutoBorrow , BindingMode , BuiltinAttr , Callable , ConstParam , Crate ,
42
42
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 ,
45
45
} ;
46
46
47
47
pub enum DescendPreference {
@@ -229,6 +229,14 @@ impl<'db, DB: HirDatabase> Semantics<'db, DB> {
229
229
pub fn to_module_defs ( & self , file : FileId ) -> impl Iterator < Item = Module > {
230
230
self . imp . to_module_def ( file)
231
231
}
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
+ }
232
240
}
233
241
234
242
impl < ' db > SemanticsImpl < ' db > {
0 commit comments