diff options
| author | bors <bors@rust-lang.org> | 2014-03-31 11:11:40 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-03-31 11:11:40 -0700 |
| commit | ba2fcc1d345c397bd7f834ccb398dc3dfc95e6bf (patch) | |
| tree | ad908fe1ae3a34816f183c7de387acf3afc792d1 /src | |
| parent | c821cacfed19d081fb5822b93f147e62e31e7931 (diff) | |
| parent | 2deca5840e108826d6aac9dfd6a1865edd957466 (diff) | |
| download | rust-ba2fcc1d345c397bd7f834ccb398dc3dfc95e6bf.tar.gz rust-ba2fcc1d345c397bd7f834ccb398dc3dfc95e6bf.zip | |
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`.
Diffstat (limited to 'src')
| -rw-r--r-- | src/libserialize/json.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs index 949275be7ca..996d17fd88f 100644 --- a/src/libserialize/json.rs +++ b/src/libserialize/json.rs @@ -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), |
