What type would you expect for a function that takes a string of the form "123" and returns an integer?
I've seen str -> int (with an exception message), str -> option<int> (no info on what was wrong) and str -> result<int,int_error> (exposes all the error types to callers).
miniblog.
Related Posts
The Rust documentation host, https://docs.rs/, has a really cute nudge to make sure your code has documentation. It exposes the docs coverage percentage in the UI!
Renaming code often exposes further needs for refactoring: https://www.fluentcpp.com/2021/04/23/make-bad-code-look-bad/
(I found the example really compelling!)
Commonmark.js has a lovely feature that's rare in markdown renderers: it exposes an AST! https://github.com/commonmark/commonmark.js/#usage
This makes it so much easier to extend/modify the syntax in a robust manner.
