Skip to content

Api Design practice problems in Rust

Difficulty:
Category:
Tag:

Showing 18 of 18

Status Title Difficulty
Associated type or generic parameter? Hard
Cargo features and the additivity rule Hard
Cow in API design: impl Into<Cow<str>> Hard
Designing safe wrappers around unsafe FFI Hard
Designing signatures: T, &T, &mut T, impl Into<T> Medium
Documenting failure: # Errors and # Panics Medium
Implementing std::error::Error Medium
#[must_use] in depth Medium
pub on structs and enums behaves differently Easy
pub use re-exports and the facade pattern Hard
Result, and why it is #[must_use] Easy
SemVer for Rust APIs: what actually breaks Hard
&str not &String, &[T] not &Vec<T> — deref coercion and ptr_arg Easy
The wildcard trap: `_` arms freeze your enum against the future Medium
Two inputs, one output lifetime Medium
Type-driven design: newtypes, smart constructors, builders, typestate Hard
Unsound API smells: the patterns that are always wrong Medium
What a &mut parameter actually promises Medium