#serialization #error #error-string #structs #traits #rustc-serialize #serde

nightly errorser

Serializes and psudo-deserializes structs implementing the Error trait

1 stable release

Uses old Rust 2015

1.0.1 Feb 7, 2016

#8 in #rustc-serialize

MIT license

11KB
156 lines

ErrorSer

Simple hack to serialize &Error values in rust, using either serde or rustc-serialize.

Note that due to the way errors are serialized, some custom ones with side effects and the like are improperly serialized, instead giving the descriptions and causes that were true at the time of serialization, instead of what is currently true. This is fine for most uses, but may cause unexpected behavior when serializing the more obscure errors.

#Links

TODO: Actually link to these things when they exist.

Documentation

Crates.io

#Examples

use errorser::{deserialize_error_string, serialize_error_string};
let error = error_prone_function();
let string = serialize_error_string(&error);
let pseudoerror = deserialize_error_string(&string).unwrap();

lib.rs:

Serializes and psudo-deserializes structs implementing the Error trait. This should only be done if you know you won't ever need an actual error value, only the description and causes.

This crate assumes that the error descriptions are complete, and are indicative of the error going on. There is also no way to get any values accoated with the error, since that would require real serialization of arbratrary structs, implementing a trait you didn't make.

Dependencies

~3.5MB
~103K SLoC