Skip to content

Commit ba2fcc1

Browse files
committed
auto merge of #13230 : Kroisse/rust/encodable-json, r=erickt
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`.
2 parents c821cac + 2deca58 commit ba2fcc1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/libserialize/json.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -732,8 +732,8 @@ impl<'a> ::Encoder<io::IoError> for PrettyEncoder<'a> {
732732
}
733733
}
734734

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

0 commit comments

Comments
 (0)