let dequeue_with_key t = Option.map (Doubly_linked.remove_first t.queue) ~f:(fun kv -> Table.remove t.table kv.key; (kv.key, kv.value))