mirror of
https://github.com/rwf2/Rocket.git
synced 2024-12-26 04:12:40 +00:00
Implement 'FromIterator' for 'JsonValue'.
This commit is contained in:
parent
3e3fe56e6a
commit
233121b6dc
@ -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
Block a user