use ToOwned trait instead of inherent method
This commit is contained in:
@@ -15,12 +15,13 @@ use crate::{
|
||||
/// conversion itself has zero runtime cost: ast and syntax nodes have exactly
|
||||
/// the same representation: a pointer to the tree root and a pointer to the
|
||||
/// node itself.
|
||||
pub trait AstNode: rowan::TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>> {
|
||||
pub trait AstNode:
|
||||
rowan::TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>> + ToOwned<Owned = TreeArc<Self>>
|
||||
{
|
||||
fn cast(syntax: &SyntaxNode) -> Option<&Self>
|
||||
where
|
||||
Self: Sized;
|
||||
fn syntax(&self) -> &SyntaxNode;
|
||||
fn to_owned(&self) -> TreeArc<Self>;
|
||||
}
|
||||
|
||||
pub trait AstToken: AstNode {
|
||||
|
||||
Reference in New Issue
Block a user