Skip to content

Commit

Permalink
auto merge of #13230 : Kroisse/rust/encodable-json, r=erickt
Browse files Browse the repository at this point in the history
The implementation of `Encodable<E, S>` for `Json` doesn't need to assume `S` to be `IoError`, only the default encoders for `Json` are depend on it. So this can be parametrize to increase flexiblity. If not, types that implement `Encoder<E>` where `E` is not `IoError` can't be worked with `Json`.
  • Loading branch information
bors committed Mar 31, 2014
2 parents c821cac + 2deca58 commit ba2fcc1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/libserialize/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -732,8 +732,8 @@ impl<'a> ::Encoder<io::IoError> for PrettyEncoder<'a> {
}
}

impl<E: ::Encoder<io::IoError>> Encodable<E, io::IoError> for Json {
fn encode(&self, e: &mut E) -> EncodeResult {
impl<E: ::Encoder<S>, S> Encodable<E, S> for Json {
fn encode(&self, e: &mut E) -> Result<(), S> {
match *self {
Number(v) => v.encode(e),
String(ref v) => v.encode(e),
Expand Down

0 comments on commit ba2fcc1

Please sign in to comment.