Is there a reason for the intermediate string? Why not format straight to `io::stdout` (probably a `BufferedWriter`d wrapped version) via the appropriate method.

(You have an example in the definition of `buffer_encode`.)