summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
new file mode 100644
index 0000000..3392039
--- /dev/null
+++ b/src/main.rs
@@ -0,0 +1,28 @@
+struct Container<K: Eq, V> {
+ values: Vec<(K, V)>,
+}
+
+impl<K: Eq, V> Container<K, V> {
+ fn new() -> Self {
+ Self { values: vec![] }
+ }
+
+ fn insert(&mut self, k: K, v: V) { /* FIXME */
+ }
+
+ fn get(&self, k: &K) -> Option<&V> {
+ None
+ }
+}
+
+fn main() {
+ let alice = "alice".to_string();
+ let bob = "bob".to_string();
+ let robert = "Robert".to_string();
+ let mut cont = Container::new();
+ cont.insert(bob.clone(), bob.clone());
+ cont.insert(bob.clone(), robert);
+ println!("{} -> {:?}", &alice, cont.get(&alice));
+ println!("{} -> {:?}", &bob, cont.get(&bob));
+ // Output should be Robert
+}