Created
January 5, 2021 07:17
-
-
Save devjev/79a528e365b96dab06d5e8a8be88b319 to your computer and use it in GitHub Desktop.
A good tree node trait
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait TreeNode<T> { | |
type RefType: AsRef<Self> + Deref<Target = Self>; | |
fn value(&self) -> T; | |
fn children(&self) -> &[Self::RefType]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment