mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-18 16:20:18 +00:00
Add new trait TypeAscriptionOwner
This trait should be implemented for nodes which have an ascribed type, e.g. thing : Type. Such as let, const, static, param, named struct fields.
This commit is contained in:
parent
7c9acf2f83
commit
6eb070d661
3 changed files with 36 additions and 9 deletions
|
@ -31,6 +31,12 @@ pub trait AstToken: AstNode {
|
|||
}
|
||||
}
|
||||
|
||||
pub trait TypeAscriptionOwner: AstNode {
|
||||
fn ascribed_type(&self) -> Option<&TypeRef> {
|
||||
child_opt(self)
|
||||
}
|
||||
}
|
||||
|
||||
pub trait NameOwner: AstNode {
|
||||
fn name(&self) -> Option<&Name> {
|
||||
child_opt(self)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue