Skip to content

Instantly share code, notes, and snippets.

@devjev
Created January 5, 2021 07:17
Show Gist options
  • Save devjev/79a528e365b96dab06d5e8a8be88b319 to your computer and use it in GitHub Desktop.
Save devjev/79a528e365b96dab06d5e8a8be88b319 to your computer and use it in GitHub Desktop.
A good tree node trait
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