---
title: "iddqd, or the hardest kind of unsafe Rust"
description: "iddqd is a Rust map library, used in Oxide's Omicron control plane, where keys are borrowed from the values themselves."
url: "https://swe.quest/articles/iddqd-or-the-hardest-kind-of-unsafe-rust-50456dacfa60840a"
canonical: "https://oxide.computer/blog/iddqd-unsafe"
source: "Oxide"
published: "2026-06-02"
difficulty: "hard"
kind: "Deep dive"
reading_minutes: 23
tags: ["rust","memory-safety","data-structures"]
---

# iddqd, or the hardest kind of unsafe Rust

A post on [Oxide](https://swe.quest/sources/oxide.md), published 2026-06-02, 23 min read, Deep dive. Original: [https://oxide.computer/blog/iddqd-unsafe](https://oxide.computer/blog/iddqd-unsafe)

## Summary

iddqd is a Rust map library, used in Oxide's Omicron control plane, where keys are borrowed from the values themselves. That avoids both passing key and value around separately and duplicating the key in both places. Internally each map pairs a slab-like ItemSet (a Vec of Occupied/Vacant slots with a free chain) with a hashbrown HashTable or B-tree index of slot indices, and BiHashMap and TriHashMap keep two or three such indexes over the same records. Because these generic structures call back into user-supplied trait code, their unsafe code (notably mutable iteration) must stay sound even against adversarial safe Rust. That is a harder standard than the slice-local or module-local reasoning needed for cases like split\_at\_mut, illustrated with a broken ExactSizeIterator example.

Written by swe.quest, not by the author.

**Difficulty:** Hard: written for specialists in the field

## Topics

- [Rust](https://swe.quest/tags/rust.md) (Languages)
- [Memory safety](https://swe.quest/tags/memory-safety.md) (Security)
- [Data structures](https://swe.quest/tags/data-structures.md) (Architecture & design)

## Prerequisites

- Rust ownership and borrowing ([easy posts on Rust](https://swe.quest/tags/rust.md?difficulty=easy))
- unsafe Rust basics ([easy posts on Rust](https://swe.quest/tags/rust.md?difficulty=easy))
- hash tables and B-trees
- Rust traits and generics ([easy posts on Rust](https://swe.quest/tags/rust.md?difficulty=easy))

## Keywords

iddqd, unsafe Rust, IdOrdMap, IdHashMap, hashbrown, Omicron, Oxide

## Related posts

- [Supporting faster file load times with memory optimizations in Rust](https://swe.quest/articles/supporting-faster-file-load-times-with-memory-optimizations-in-rust-9b748f81216508a0.md): Figma · 2025-06-18 · Medium · 6 min read · Rust, Memory management, Performance engineering, Data structures, Real-time systems
  Figma's Rust multiplayer server represented each file node as a BTreeMap from u16 property IDs to pointers, and memory profiling showed this map used over 60% of a file's memory.
- [Announcing Rust 1.99.0](https://swe.quest/articles/announcing-rust-1-99-0-e5a9ff006cef8681.md): Rust Blog · 2026-10-01 · Medium · 2 min read · Rust, Memory management
  Rust 1.99.0 stabilizes defining C-ABI variadic functions in Rust using \`...\`, typed as \`VaList\` (ABI-compatible with C \`va\_list\`) with readable types gated by the \`VaArgSafe\` trait.
- [This Week at Zed Industries: #12](https://swe.quest/articles/this-week-at-zed-industries-12-12effbc7b871501a.md): Zed · 2023-07-21 · Medium · 7 min read · Rust, Real-time systems, Consistency models, Developer tools, Replication
  Zed publicly launched its preview channel and reports progress across the editor: Vim search commands, macOS ctrl-click remapped to right click in the platform layer, terminal Cmd+hover navigation, a semantic index that collapses nested tree-sitter symbols to cut embedding tokens, and a lock-contention bug where slow git status in huge repos serializes file scanning.
- [This Week at Zed Industries: #14](https://swe.quest/articles/this-week-at-zed-industries-14-199a97b20076bb41.md): Zed · 2023-08-04 · Easy · 6 min read · Distributed systems, Replication, Data structures, Developer tools, Rust
  Zed's weekly update covers a reworked search UI with semantic search, the start of WebAssembly extensions for custom language servers, and near-complete collaboration channels.
- [This Week at Zed Industries: #1](https://swe.quest/articles/this-week-at-zed-industries-1-0d07c1f998ae465c.md): Zed · 2023-01-23 · Medium · 4 min read · Developer tools, Performance engineering, Data structures, Rust
  Zed grew out of Xray, the experimental editor Nathan Sobo and Antonio worked on at GitHub in 2018, and this weekly update recaps the path from there to a company and a private alpha.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
