This article is part of the series Making our own ping:
- A short (and mostly wrong) history of computer networking
- Windows dynamic libraries, calling conventions, and transmute
- FFI-safe types in Rust, newtypes, MaybeUninit, and references vs pointers
- Designing and implementing a safer API on top of LoadLibrary
- A simple ping library, parsing strings into IPv4 address
- The builder pattern, and a macro that keeps FFI code DRY
It’s refactor time!
Our complete program is now about a hundred lines, counting blank lines (see the end of part 3 for a complete listing).
While this is pretty good for a zero-dependency project (save for
pretty-hex), we can do better.
First off, concerns are mixed up. In the same file, we:
Want to read more?
This post is Patreon-exclusive until October 25, 2019
Become a Patron now to get early access to all my posts. Learn more