Skip to content

Instantly share code, notes, and snippets.

@spacejam
Forked from anonymous/playground.rs
Last active January 15, 2018 23:46
Show Gist options
  • Save spacejam/f98e730583e74742122e6678a7259721 to your computer and use it in GitHub Desktop.
Save spacejam/f98e730583e74742122e6678a7259721 to your computer and use it in GitHub Desktop.
Rust code shared from the playground
struct Node<K, V>
where
K: Ord
{
key: K,
value: V,
left: Option<Box<Node<K, V>>>,
right: Option<Box<Node<K, V>>>,
}
#[derive(Default)]
pub struct Tree<K, V>
where
K: Ord
{
root: Option<Node<K, V>>,
}
impl<K, V> Tree<K, V>
where
K: Ord
{
pub fn insert(&mut self, key: K, value: V) {}
pub fn get(&self, key: &K) -> Option<&V> {
None
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment