mirror of https://github.com/rwf2/Rocket.git
Implement 'FromIterator' for 'JsonValue'.
This commit is contained in:
parent
d07628e0e4
commit
fd05f998ab
|
@ -19,6 +19,7 @@ extern crate serde_json;
|
|||
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use std::io::{self, Read};
|
||||
use std::iter::FromIterator;
|
||||
|
||||
use rocket::request::Request;
|
||||
use rocket::outcome::Outcome::*;
|
||||
|
@ -277,6 +278,12 @@ impl From<serde_json::Value> for JsonValue {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T> FromIterator<T> for JsonValue where serde_json::Value: FromIterator<T> {
|
||||
fn from_iter<I: IntoIterator<Item=T>>(iter: I) -> Self {
|
||||
JsonValue(serde_json::Value::from_iter(iter))
|
||||
}
|
||||
}
|
||||
|
||||
/// Serializes the value into JSON. Returns a response with Content-Type JSON
|
||||
/// and a fixed-size body with the serialized value.
|
||||
impl<'a> Responder<'a> for JsonValue {
|
||||
|
|
Loading…
Reference in New Issue