-
-
Save spacejam/ee1e383eaa17c85d177450598987a353 to your computer and use it in GitHub Desktop.
Rust code shared from the playground
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
struct Node<K, V> | |
where | |
K: Ord + Sized, | |
V: Sized, | |
{ | |
key: K, | |
value: V, | |
left: Option<Box<Node<K, V>>>, | |
right: Option<Box<Node<K, V>>>, | |
} | |
pub struct Tree<K, V> | |
where | |
K: Ord + Sized, | |
V: Sized, | |
{ | |
root: Option<Node<K, V>>, | |
} | |
impl<K, V> Tree<K, V> | |
where | |
K: Ord + Sized, | |
V: Sized, | |
{ | |
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