Updated error handling, crate-type and .gitignore

* Error handling for IO functions are now using Result with error messages.
* Results from `write()` and `flush()` in `std::io::Writer` are handled.
* `--lib` has been changed to `--crate-type=lib`.
* .rlib-files are now ignored by git.