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`.
This commit is contained in:
commit
ba2fcc1d34
@ -732,8 +732,8 @@ fn emit_map_elt_val(&mut self,
|
||||
}
|
||||
}
|
||||
|
||||
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),
|
||||
|
Loading…
Reference in New Issue
Block a user