mirror of https://github.com/rwf2/Rocket.git
Update 'toml' to '0.5'.
This commit is contained in:
parent
949b01cb9d
commit
27b26188c4
|
@ -388,7 +388,6 @@ pub use tokio::task::spawn_blocking;
|
|||
feature = "diesel_mysql_pool"))]
|
||||
pub extern crate diesel;
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
use std::fmt::{self, Display, Formatter};
|
||||
use std::marker::{Send, Sized};
|
||||
|
||||
|
@ -444,7 +443,7 @@ pub struct DatabaseConfig<'a> {
|
|||
pub pool_size: u32,
|
||||
/// Any extra options that are included in the configuration, **excluding**
|
||||
/// the url and pool_size.
|
||||
pub extras: BTreeMap<String, Value>,
|
||||
pub extras: rocket::config::Map<String, Value>,
|
||||
}
|
||||
|
||||
/// A wrapper around `r2d2::Error`s or a custom database error type.
|
||||
|
|
|
@ -12,8 +12,7 @@ mod databases_tests {
|
|||
#[cfg(all(feature = "databases", feature = "sqlite_pool"))]
|
||||
#[cfg(test)]
|
||||
mod rusqlite_integration_test {
|
||||
use std::collections::BTreeMap;
|
||||
use rocket::config::{Config, Environment, Value};
|
||||
use rocket::config::{Config, Environment, Value, Map};
|
||||
use rocket_contrib::databases::rusqlite;
|
||||
use rocket_contrib::database;
|
||||
|
||||
|
@ -24,8 +23,8 @@ mod rusqlite_integration_test {
|
|||
|
||||
#[rocket::async_test]
|
||||
async fn deref_mut_impl_present() {
|
||||
let mut test_db: BTreeMap<String, Value> = BTreeMap::new();
|
||||
let mut test_db_opts: BTreeMap<String, Value> = BTreeMap::new();
|
||||
let mut test_db: Map<String, Value> = Map::new();
|
||||
let mut test_db_opts: Map<String, Value> = Map::new();
|
||||
test_db_opts.insert("url".into(), Value::String(":memory:".into()));
|
||||
test_db.insert("test_db".into(), Value::Table(test_db_opts));
|
||||
let config = Config::build(Environment::Development)
|
||||
|
@ -45,8 +44,8 @@ mod rusqlite_integration_test {
|
|||
|
||||
#[rocket::async_test]
|
||||
async fn deref_impl_present() {
|
||||
let mut test_db: BTreeMap<String, Value> = BTreeMap::new();
|
||||
let mut test_db_opts: BTreeMap<String, Value> = BTreeMap::new();
|
||||
let mut test_db: Map<String, Value> = Map::new();
|
||||
let mut test_db_opts: Map<String, Value> = Map::new();
|
||||
test_db_opts.insert("url".into(), Value::String(":memory:".into()));
|
||||
test_db.insert("test_db".into(), Value::Table(test_db_opts));
|
||||
let config = Config::build(Environment::Development)
|
||||
|
|
|
@ -29,7 +29,7 @@ rocket_http = { version = "0.5.0-dev", path = "../http" }
|
|||
futures = "0.3.0"
|
||||
yansi = "0.5"
|
||||
log = { version = "0.4", features = ["std"] }
|
||||
toml = "0.4.7"
|
||||
toml = "0.5"
|
||||
num_cpus = "1.0"
|
||||
state = "0.4.1"
|
||||
time = "0.2.11"
|
||||
|
|
|
@ -199,7 +199,7 @@ use std::path::{Path, PathBuf};
|
|||
use toml;
|
||||
|
||||
pub use self::custom_values::Limits;
|
||||
pub use toml::value::{Array, Table, Value, Datetime};
|
||||
pub use toml::value::{Array, Map, Table, Value, Datetime};
|
||||
pub use self::error::ConfigError;
|
||||
pub use self::environment::Environment;
|
||||
pub use self::config::Config;
|
||||
|
|
|
@ -103,7 +103,8 @@ impl fmt::Display for LoggedValue<'_> {
|
|||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use std::collections::BTreeMap;
|
||||
use toml::map::Map;
|
||||
|
||||
use super::parse_simple_toml_value;
|
||||
use super::Value::{self, *};
|
||||
|
||||
|
@ -131,16 +132,16 @@ mod test {
|
|||
assert_parse!("[1, 2, 3]", vec![1, 2, 3].into());
|
||||
assert_parse!("[1.32, 2]", Array(vec![1.32.into(), 2.into()]));
|
||||
|
||||
assert_parse!("{}", Table(BTreeMap::new()));
|
||||
assert_parse!("{}", Table(Map::new()));
|
||||
|
||||
assert_parse!("{a=b}", Table({
|
||||
let mut map = BTreeMap::new();
|
||||
let mut map = Map::new();
|
||||
map.insert("a".into(), "b".into());
|
||||
map
|
||||
}));
|
||||
|
||||
assert_parse!("{v=1, on=true,pi=3.14}", Table({
|
||||
let mut map = BTreeMap::new();
|
||||
let mut map = Map::new();
|
||||
map.insert("v".into(), 1.into());
|
||||
map.insert("on".into(), true.into());
|
||||
map.insert("pi".into(), 3.14.into());
|
||||
|
@ -148,7 +149,7 @@ mod test {
|
|||
}));
|
||||
|
||||
assert_parse!("{v=[1, 2, 3], v2=[a, \"b\"], on=true,pi=3.14}", Table({
|
||||
let mut map = BTreeMap::new();
|
||||
let mut map = Map::new();
|
||||
map.insert("v".into(), vec![1, 2, 3].into());
|
||||
map.insert("v2".into(), vec!["a", "b"].into());
|
||||
map.insert("on".into(), true.into());
|
||||
|
@ -157,7 +158,7 @@ mod test {
|
|||
}));
|
||||
|
||||
assert_parse!("{v=[[1], [2, 3], [4,5]]}", Table({
|
||||
let mut map = BTreeMap::new();
|
||||
let mut map = Map::new();
|
||||
let first: Value = vec![1].into();
|
||||
let second: Value = vec![2, 3].into();
|
||||
let third: Value = vec![4, 5].into();
|
||||
|
|
Loading…
Reference in New Issue