Bare String/u64 for domain values | Newtype with private field | references/newtypes-and-domain-types.md |
bool parameter or state field | Two-variant enum | references/bool-to-enum.md |
Option<bool> / nested Option | Named enum variants | references/option-bool-to-enum.md |
_ => on your own enum | List every variant | references/exhaustive-matching.md |
Error(String) in a library | Typed error enum scoped to the operation | error-handling.md |
| Validate then forget | Parse into a domain type | references/parse-dont-validate.md |
kind field + Option payloads | Enum with per-variant data | references/enums-as-modeling-tool.md |
Box<dyn Trait> for a closed set | Enum, or generics if the set is open | traits.md |
Function takes Vec<T>/String but only reads | Borrow &[T] / &str | references/borrow-by-default.md |
| Defensive clone or lifetime fight | Redesign ownership before adding escape hatches | ownership.md |
for i in 0..v.len() | Iterator chain | references/iterators-over-indexing.md |
| Magic number/string for absence | Option<T> | references/option-over-sentinels.md |
| Parallel collections with shared keys | Single collection of structs | references/struct-collections.md |
&mut self builder setters | Consuming self chains | references/transform-over-mutate.md |
| Unit struct with only associated functions | Module with free functions | references/impl-namespace.md |
One meaningful match arm | if let, let ... else, or matches! | references/pattern-matching-tools.md |
Trivial get_x() / set_x() | Public field or x() accessor with invariant | references/getter-setter.md |
Everything pub / one giant file | Modules plus curated visibility | references/visibility-and-modules.md |
| Blocking work or unbounded fan-out in async code | Async waits; CPU blocks elsewhere; bound everything | async.md |
| Atomic ordering chosen by vibe | Use atomics only with a written proof | atomics.md |
| Unsafe added to bypass compiler friction | Isolate unsafe and document the invariant | unsafe.md |
| Wire format leaking into internals | Translate DTOs into domain types | serde.md |
| FFI or host-runtime boundary | Keep the ABI small, typed, and panic-safe | interop.md |
| Crate/workspace/API shape unclear | Stay single-crate until the boundary has a name | project-structure.md |