Rust Book EPUB Edition

Pocketing the Crab

Rebuilding the Rust Book EPUB generation from the ground up to create the ultimate reading experience on mobile devices.

I dare you to touch me!
Standing Rustacean Walking Rustacean

The Readability Hurdle

Ever tried to read dense Rust code on a 5-inch phone screen? Standard EPUB generators treat code blocks as stubborn, unbroken walls of text. You're left constantly swiping left and right, losing your place, and getting frustrated. The amazing Rust Programming Language Book deserved better than a generic, clunky formatting pipeline.

A Custom Pipeline in Rust

There was no EPUB generator in the project, not to mention one that would be optimized for mobile consumption. I have implemented a custom converter to EPUB format, in Rust, of course. I adjusted every code block and listing (most of which are code blocks) to be mobile optimized. The result is a perfectly compliant EPUB 3 archive, which can be consumed both on a big screen as well as on a small screen, almost without any significant losses. Of course, there is so much you can fit and optimize into a small screen.

Significant Sample Code Overhaul

This wasn't just about tweaking font sizes. I completely overhauled the structure so you can actually read almost any code in an "unbroken" format.

  • Comment Readjustment: I have readjusted and moved comments using custom scripts, regular expressions and sed/awk dark magic to optimize for non breaking lines of code. I prioritized non breaking code (comments can break sometimes which is fine and doesn't mess up the flow as breaking and misaligned code lines do)
  • Smart Reflow: Long code strings now wrap intelligently using advanced CSS rules so you never have to scroll horizontally just to read a function signature.