At the very least this needs consolidation into having the unsafety in one location instead of 3. Can you open an issue about making this use `&mut Writer` instead of `~Writer`?