Rust | HashMap
rust\nuse std::collections::HashMap;\n\n#[derive(Default)]\nstruct OrderedStream {\n    ptr : usize,\n    store : HashMap<usize, String>\n}\n\n\nimpl OrderedStr
```rust\nuse std::collections::HashMap;\n\n#[derive(Default)]\nstruct OrderedStream {\n    ptr : usize,\n    store : HashMap<usize, String>\n}\n\n\nimpl OrderedStream {\n\n    fn new(n: i32) -> Self {\n        Default::default()\n    }\n    \n    fn insert(&mut self, id_key: i32, value: String) -> Vec<String> {\n        let id_key = (id_key - 1) as usize;\n        self.store.insert(id_key, value);\n        \n        let mut res = vec![];\n        \n        if id_key == self.ptr{\n            while let Some(val) = self.store.remove(&self.ptr){\n                res.push(val);\n                self.ptr+=1;\n            }\n        }\n        \n        res\n    }\n}\n```
['Rust']