let foldi t ~init ~f = read t (fun () -> Doubly_linked.fold t.queue ~init ~f:(fun ac kv -> (f ac ~key:kv.key ~data:kv.value)))