diff options
author | Conrad Ludgate <conradludgate@gmail.com> | 2021-11-22 14:00:10 +0000 |
---|---|---|
committer | Conrad Ludgate <conradludgate@gmail.com> | 2021-11-23 07:40:53 +0000 |
commit | 11296ae50625053a64dbc7210dff814899879d0f (patch) | |
tree | d377f13881451f0b27eace0be61d0466ecb7c9e7 | |
parent | 3b60b9f5575ae60a672f006040707af423f67390 (diff) |
rename try_into to try_deserialize to avoid confusion
-rw-r--r-- | examples/glob/src/main.rs | 6 | ||||
-rw-r--r-- | examples/hierarchical-env/src/settings.rs | 2 | ||||
-rw-r--r-- | examples/simple/src/main.rs | 2 | ||||
-rw-r--r-- | examples/watch/src/main.rs | 2 | ||||
-rw-r--r-- | src/config.rs | 6 | ||||
-rw-r--r-- | src/ser.rs | 2 | ||||
-rw-r--r-- | src/value.rs | 2 | ||||
-rw-r--r-- | tests/defaults.rs | 4 | ||||
-rw-r--r-- | tests/empty.rs | 2 | ||||
-rw-r--r-- | tests/env.rs | 22 | ||||
-rw-r--r-- | tests/errors.rs | 10 | ||||
-rw-r--r-- | tests/file_ini.rs | 2 | ||||
-rw-r--r-- | tests/file_json.rs | 2 | ||||
-rw-r--r-- | tests/file_json5.rs | 2 | ||||
-rw-r--r-- | tests/file_ron.rs | 2 | ||||
-rw-r--r-- | tests/file_toml.rs | 2 | ||||
-rw-r--r-- | tests/file_yaml.rs | 2 | ||||
-rw-r--r-- | tests/get.rs | 12 | ||||
-rw-r--r-- | tests/legacy/env.rs | 22 | ||||
-rw-r--r-- | tests/legacy/errors.rs | 10 | ||||
-rw-r--r-- | tests/legacy/file_ini.rs | 2 | ||||
-rw-r--r-- | tests/legacy/file_json.rs | 2 | ||||
-rw-r--r-- | tests/legacy/file_ron.rs | 2 | ||||
-rw-r--r-- | tests/legacy/file_toml.rs | 2 | ||||
-rw-r--r-- | tests/legacy/file_yaml.rs | 2 | ||||
-rw-r--r-- | tests/legacy/get.rs | 12 | ||||
-rw-r--r-- | tests/weird_keys.rs | 2 |
27 files changed, 70 insertions, 70 deletions
diff --git a/examples/glob/src/main.rs b/examples/glob/src/main.rs index b3183ef..5e81f3c 100644 --- a/examples/glob/src/main.rs +++ b/examples/glob/src/main.rs @@ -16,7 +16,7 @@ fn main() { // Print out our settings (as a HashMap) println!("\n{:?} \n\n-----------", - settings.try_into::<HashMap<String, String>>().unwrap()); + settings.try_deserialize::<HashMap<String, String>>().unwrap()); // Option 2 // -------- @@ -30,7 +30,7 @@ fn main() { // Print out our settings (as a HashMap) println!("\n{:?} \n\n-----------", - settings.try_into::<HashMap<String, String>>().unwrap()); + settings.try_deserialize::<HashMap<String, String>>().unwrap()); // Option 3 // -------- @@ -45,5 +45,5 @@ fn main() { // Print out our settings (as a HashMap) println!("\n{:?} \n\n-----------", - settings.try_into::<HashMap<String, String>>().unwrap()); + settings.try_deserialize::<HashMap<String, String>>().unwrap()); } diff --git a/examples/hierarchical-env/src/settings.rs b/examples/hierarchical-env/src/settings.rs index 0fa59d2..7ef58b8 100644 --- a/examples/hierarchical-env/src/settings.rs +++ b/examples/hierarchical-env/src/settings.rs @@ -65,6 +65,6 @@ impl Settings { println!("database: {:?}", s.get::<String>("database.url")); // You can deserialize (and thus freeze) the entire configuration as - s.try_into() + s.try_deserialize() } } diff --git a/examples/simple/src/main.rs b/examples/simple/src/main.rs index 1c7ddb7..b38dcbf 100644 --- a/examples/simple/src/main.rs +++ b/examples/simple/src/main.rs @@ -11,5 +11,5 @@ fn main() { // Print out our settings (as a HashMap) println!("{:?}", - settings.try_into::<HashMap<String, String>>().unwrap()); + settings.try_deserialize::<HashMap<String, String>>().unwrap()); } diff --git a/examples/watch/src/main.rs b/examples/watch/src/main.rs index a197390..9f3d21a 100644 --- a/examples/watch/src/main.rs +++ b/examples/watch/src/main.rs @@ -20,7 +20,7 @@ fn show() { .read() .unwrap() .clone() - .try_into::<HashMap<String, String>>() + .try_deserialize::<HashMap<String, String>>() .unwrap()); } diff --git a/src/config.rs b/src/config.rs index 55844ce..864c0ec 100644 --- a/src/config.rs +++ b/src/config.rs @@ -190,7 +190,7 @@ impl Config { } /// Attempt to deserialize the entire configuration into the requested type. - pub fn try_into<'de, T: Deserialize<'de>>(self) -> Result<T> { + pub fn try_deserialize<'de, T: Deserialize<'de>>(self) -> Result<T> { T::deserialize(self) } @@ -201,9 +201,9 @@ impl Config { Ok(serializer.output) } - #[deprecated(since = "0.7.0", note = "please use 'try_into' instead")] + #[deprecated(since = "0.7.0", note = "please use 'try_deserialize' instead")] pub fn deserialize<'de, T: Deserialize<'de>>(self) -> Result<T> { - self.try_into() + self.try_deserialize() } } @@ -713,7 +713,7 @@ mod test { }; let config = Config::try_from(&test).unwrap(); - let actual: Test = config.try_into().unwrap(); + let actual: Test = config.try_deserialize().unwrap(); assert_eq!(test, actual); } } diff --git a/src/value.rs b/src/value.rs index 6825284..2f6f8c8 100644 --- a/src/value.rs +++ b/src/value.rs @@ -211,7 +211,7 @@ impl Value { } /// Attempt to deserialize this value into the requested type. - pub fn try_into<'de, T: Deserialize<'de>>(self) -> Result<T> { + pub fn try_deserialize<'de, T: Deserialize<'de>>(self) -> Result<T> { T::deserialize(self) } diff --git a/tests/defaults.rs b/tests/defaults.rs index 5cb86f3..724d6a2 100644 --- a/tests/defaults.rs +++ b/tests/defaults.rs @@ -22,7 +22,7 @@ impl Default for Settings { #[test] fn set_defaults() { let c = Config::default(); - let s: Settings = c.try_into().expect("Deserialization failed"); + let s: Settings = c.try_deserialize().expect("Deserialization failed"); assert_eq!(s.db_host, "default"); } @@ -30,6 +30,6 @@ fn set_defaults() { #[test] fn try_from_defaults() { let c = Config::try_from(&Settings::default()).expect("Serialization failed"); - let s: Settings = c.try_into().expect("Deserialization failed"); + let s: Settings = c.try_deserialize().expect("Deserialization failed"); assert_eq!(s.db_host, "default"); } diff --git a/tests/empty.rs b/tests/empty.rs index a763a1b..18634fc 100644 --- a/tests/empty.rs +++ b/tests/empty.rs @@ -16,7 +16,7 @@ struct Settings { #[test] fn empty_deserializes() { let s: Settings = Config::default() - .try_into() + .try_deserialize() .expect("Deserialization failed"); assert_eq!(s.foo, 0); assert_eq!(s.bar, 0); diff --git a/tests/env.rs b/tests/env.rs index 4d1a966..fa076b6 100644 --- a/tests/env.rs +++ b/tests/env.rs @@ -113,7 +113,7 @@ fn test_parse_int() { .build() .unwrap(); - let config: TestIntEnum = config.try_into().unwrap(); + let config: TestIntEnum = config.try_deserialize().unwrap(); assert!(matches!(config, TestIntEnum::Int(TestInt { int_val: 42 }))); @@ -145,7 +145,7 @@ fn test_parse_float() { .build() .unwrap(); - let config: TestFloatEnum = config.try_into().unwrap(); + let config: TestFloatEnum = config.try_deserialize().unwrap(); // can't use `matches!` because of float value match config { @@ -180,7 +180,7 @@ fn test_parse_bool() { .build() .unwrap(); - let config: TestBoolEnum = config.try_into().unwrap(); + let config: TestBoolEnum = config.try_deserialize().unwrap(); assert!(matches!( config, @@ -218,7 +218,7 @@ fn test_parse_off_int() { env::remove_var("INT_VAL_1"); - config.try_into::<TestIntEnum>().unwrap(); + config.try_deserialize::<TestIntEnum>().unwrap(); } #[test] @@ -249,7 +249,7 @@ fn test_parse_off_float() { env::remove_var("FLOAT_VAL_1"); - config.try_into::<TestFloatEnum>().unwrap(); + config.try_deserialize::<TestFloatEnum>().unwrap(); } #[test] @@ -280,7 +280,7 @@ fn test_parse_off_bool() { env::remove_var("BOOL_VAL_1"); - config.try_into::<TestBoolEnum>().unwrap(); + config.try_deserialize::<TestBoolEnum>().unwrap(); } #[test] @@ -311,7 +311,7 @@ fn test_parse_int_fail() { env::remove_var("INT_VAL_2"); - config.try_into::<TestIntEnum>().unwrap(); + config.try_deserialize::<TestIntEnum>().unwrap(); } #[test] @@ -342,7 +342,7 @@ fn test_parse_float_fail() { env::remove_var("FLOAT_VAL_2"); - config.try_into::<TestFloatEnum>().unwrap(); + config.try_deserialize::<TestFloatEnum>().unwrap(); } #[test] @@ -373,7 +373,7 @@ fn test_parse_bool_fail() { env::remove_var("BOOL_VAL_2"); - config.try_into::<TestBoolEnum>().unwrap(); + config.try_deserialize::<TestBoolEnum>().unwrap(); } #[test] @@ -401,7 +401,7 @@ fn test_parse_string() { .build() .unwrap(); - let config: TestStringEnum = config.try_into().unwrap(); + let config: TestStringEnum = config.try_deserialize().unwrap(); let test_string = String::from("test string"); @@ -437,7 +437,7 @@ fn test_parse_off_string() { .build() .unwrap(); - let config: TestStringEnum = config.try_into().unwrap(); + let config: TestStringEnum = config.try_deserialize().unwrap(); let test_string = String::from("test string"); diff --git a/tests/errors.rs b/tests/errors.rs index 60f1121..1c4edb9 100644 --- a/tests/errors.rs +++ b/tests/errors.rs @@ -57,7 +57,7 @@ fn test_error_type_detached() { let c = make(); let value = c.get::<Value>("boolean_s_parse").unwrap(); - let res = value.try_into::<bool>(); + let res = value.try_deserialize::<bool>(); assert!(res.is_err()); assert_eq!( @@ -77,14 +77,14 @@ fn test_error_enum_de() { } let on_v: Value = "on".into(); - let on_d = on_v.try_into::<Diode>(); + let on_d = on_v.try_deserialize::<Diode>(); assert_eq!( on_d.unwrap_err().to_string(), "enum Diode does not have variant constructor on".to_string() ); let array_v: Value = vec![100, 100].into(); - let array_d = array_v.try_into::<Diode>(); + let array_d = array_v.try_deserialize::<Diode>(); assert_eq!( array_d.unwrap_err().to_string(), "value of enum Diode should be represented by either string or table with exactly one key" @@ -98,7 +98,7 @@ fn test_error_enum_de() { .cloned() .collect::<Map<String, Value>>() .into(); - let confused_d = confused_v.try_into::<Diode>(); + let confused_d = confused_v.try_deserialize::<Diode>(); assert_eq!( confused_d.unwrap_err().to_string(), "value of enum Diode should be represented by either string or table with exactly one key" @@ -125,7 +125,7 @@ inner: .add_source(File::from_str(CFG, FileFormat::Yaml)) .build() .unwrap() - .try_into::<Outer>() + .try_deserialize::<Outer>() .unwrap_err(); if let ConfigError::Type { diff --git a/tests/file_ini.rs b/tests/file_ini.rs index 332d3ea..d72b46c 100644 --- a/tests/file_ini.rs +++ b/tests/file_ini.rs @@ -37,7 +37,7 @@ fn make() -> Config { #[test] fn test_file() { let c = make(); - let s: Settings = c.try_into().unwrap(); + let s: Settings = c.try_deserialize().unwrap(); assert_eq!( s, Settings { diff --git a/tests/file_json.rs b/tests/file_json.rs index d3fa0a9..5a04afd 100644 --- a/tests/file_json.rs +++ b/tests/file_json.rs @@ -45,7 +45,7 @@ fn test_file() { let c = make(); // Deserialize the entire file as single struct - let s: Settings = c.try_into().unwrap(); + let s: Settings = c.try_deserialize().unwrap(); assert!(s.debug.approx_eq_ulps(&1.0, 2)); assert_eq!(s.production, Some("false".to_string())); diff --git a/tests/file_json5.rs b/tests/file_json5.rs index a768bba..bd56b0f 100644 --- a/tests/file_json5.rs +++ b/tests/file_json5.rs @@ -44,7 +44,7 @@ fn test_file() { let c = make(); // Deserialize the entire file as single struct - let s: Settings = c.try_into().unwrap(); + let s: Settings = c.try_deserialize().unwrap(); assert!(s.debug.approx_eq_ulps(&1.0, 2)); assert_eq!(s.production, Some("false".to_string())); diff --git a/tests/file_ron.rs b/tests/file_ron.rs index 32c7192..a06b8d4 100644 --- a/tests/file_ron.rs +++ b/tests/file_ron.rs @@ -46,7 +46,7 @@ fn test_file() { let c = make(); // Deserialize the entire file as single struct - let s: Settings = c.try_into().unwrap(); + let s: Settings = c.try_deserialize().unwrap(); assert!(s.debug.approx_eq_ulps(&1.0, 2)); assert_eq!(s.production, Some("false".to_string())); diff --git a/tests/file_toml.rs b/tests/file_toml.rs index b6bb537..1033b6a 100644 --- a/tests/file_toml.rs +++ b/tests/file_toml.rs @@ -54,7 +54,7 @@ fn test_file() { let c = make(); // Deserialize the entire file as single struct - let s: Settings = c.try_into().unwrap(); + let s: Settings = c.try_deserialize().unwrap(); assert!(s.debug.approx_eq_ulps(&1.0, 2)); assert_eq!(s.production, Some("false".to_string())); diff --git a/tests/file_yaml.rs b/tests/file_yaml.rs index c87d5e9..440f985 100644 --- a/tests/file_yaml.rs +++ b/tests/file_yaml.rs @@ -45,7 +45,7 @@ fn test_file() { let c = make(); // Deserialize the entire file as single struct - let s: Settings = c.try_into().unwrap(); + let s: Settings = c.try_deserialize().unwrap(); assert!(s.debug.approx_eq_ulps(&1.0, 2)); assert_eq!(s.production, Some("false".to_string())); diff --git a/tests/get.rs b/tests/get.rs index cc9befb..79028c5 100644 --- a/tests/get.rs +++ b/tests/get.rs @@ -145,7 +145,7 @@ fn test_map_struct() { } let c = make(); - let s: Settings = c.try_into().unwrap(); + let s: Settings = c.try_deserialize().unwrap(); assert_eq!(s.place.len(), 8); assert_eq!( @@ -160,7 +160,7 @@ fn test_file_struct() { let c = make(); // Deserialize the entire file as single struct - let s: Settings = c.try_into().unwrap(); + let s: Settings = c.try_deserialize().unwrap(); assert!(s.debug.approx_eq_ulps(&1.0, 2)); assert_eq!(s.production, Some("false".to_string())); @@ -208,7 +208,7 @@ fn test_struct_array() { } let c = make(); - let s: Settings = c.try_into().unwrap(); + let s: Settings = c.try_deserialize().unwrap(); assert_eq!(s.elements.len(), 10); assert_eq!(s.elements[3], "4".to_string()); @@ -230,7 +230,7 @@ fn test_enum() { } let c = make(); - let s: Settings = c.try_into().unwrap(); + let s: Settings = c.try_deserialize().unwrap(); assert_eq!(s.diodes["green"], Diode::Off); assert_eq!(s.diodes["red"], Diode::Brightness(100)); @@ -265,7 +265,7 @@ fn test_enum_key() { } let c = make(); - let s: Settings = c.try_into().unwrap(); + let s: Settings = c.try_deserialize().unwrap(); assert_eq!(s.proton[&Quark::Up], 2); assert_eq!(s.quarks.len(), 6); @@ -279,7 +279,7 @@ fn test_int_key() { } let c = make(); - let s: Settings = c.try_into().unwrap(); + let s: Settings = c.try_deserialize().unwrap(); assert_eq!(s.divisors[&4], 3); assert_eq!(s.divisors.len(), 4); } diff --git a/tests/legacy/env.rs b/tests/legacy/env.rs index adba260..775b8d7 100644 --- a/tests/legacy/env.rs +++ b/tests/legacy/env.rs @@ -32,7 +32,7 @@ fn test_parse_int() { config.merge(environment).unwrap(); - let config: TestIntEnum = config.try_into().unwrap(); + let config: TestIntEnum = config.try_deserialize().unwrap(); assert!(matches!(config, TestIntEnum::Int(TestInt { int_val: 42 }))); @@ -62,7 +62,7 @@ fn test_parse_float() { config.merge(environment).unwrap(); - let config: TestFloatEnum = config.try_into().unwrap(); + let config: TestFloatEnum = config.try_deserialize().unwrap(); // can't use `matches!` because of float value match config { @@ -95,7 +95,7 @@ fn test_parse_bool() { config.merge(environment).unwrap(); - let config: TestBoolEnum = config.try_into().unwrap(); + let config: TestBoolEnum = config.try_deserialize().unwrap(); assert!(matches!( config, @@ -131,7 +131,7 @@ fn test_parse_off_int() { env::remove_var("INT_VAL_1"); - config.try_into::<TestIntEnum>().unwrap(); + config.try_deserialize::<TestIntEnum>().unwrap(); } #[test] @@ -160,7 +160,7 @@ fn test_parse_off_float() { env::remove_var("FLOAT_VAL_1"); - config.try_into::<TestFloatEnum>().unwrap(); + config.try_deserialize::<TestFloatEnum>().unwrap(); } #[test] @@ -189,7 +189,7 @@ fn test_parse_off_bool() { env::remove_var("BOOL_VAL_1"); - config.try_into::<TestBoolEnum>().unwrap(); + config.try_deserialize::<TestBoolEnum>().unwrap(); } #[test] @@ -218,7 +218,7 @@ fn test_parse_int_fail() { env::remove_var("INT_VAL_2"); - config.try_into::<TestIntEnum>().unwrap(); + config.try_deserialize::<TestIntEnum>().unwrap(); } #[test] @@ -247,7 +247,7 @@ fn test_parse_float_fail() { env::remove_var("FLOAT_VAL_2"); - config.try_into::<TestFloatEnum>().unwrap(); + config.try_deserialize::<TestFloatEnum>().unwrap(); } #[test] @@ -276,7 +276,7 @@ fn test_parse_bool_fail() { env::remove_var("BOOL_VAL_2"); - config.try_into::<TestBoolEnum>().unwrap(); + config.try_deserialize::<TestBoolEnum>().unwrap(); } #[test] @@ -302,7 +302,7 @@ fn test_parse_string() { config.merge(environment).unwrap(); - let config: TestStringEnum = config.try_into().unwrap(); + let config: TestStringEnum = config.try_deserialize().unwrap(); let test_string = String::from("test string"); @@ -336,7 +336,7 @@ fn test_parse_off_string() { config.merge(environment).unwrap(); - let config: TestStringEnum = config.try_into().unwrap(); + let config: TestStringEnum = config.try_deserialize().unwrap(); let test_string = String::from("test string"); diff --git a/tests/legacy/errors.rs b/tests/legacy/errors.rs index c0ce234..06b67ab 100644 --- a/tests/legacy/errors.rs +++ b/tests/legacy/errors.rs @@ -54,7 +54,7 @@ fn test_error_type_detached() { let c = make(); let value = c.get::<Value>("boolean_s_parse").unwrap(); - let res = value.try_into::<bool>(); + let res = value.try_deserialize::<bool>(); assert!(res.is_err()); assert_eq!( @@ -74,14 +74,14 @@ fn test_error_enum_de() { } let on_v: Value = "on".into(); - let on_d = on_v.try_into::<Diode>(); + let on_d = on_v.try_deserialize::<Diode>(); assert_eq!( on_d.unwrap_err().to_string(), "enum Diode does not have variant constructor on".to_string() ); let array_v: Value = vec![100, 100].into(); - let array_d = array_v.try_into::<Diode>(); + let array_d = array_v.try_deserialize::<Diode>(); assert_eq!( array_d.unwrap_err().to_string(), "value of enum Diode should be represented by either string or table with exactly one key" @@ -95,7 +95,7 @@ fn test_error_enum_de() { .cloned() .collect::<Map<String, Value>>() .into(); - let confused_d = confused_v.try_into::<Diode>(); + let confused_d = confused_v.try_deserialize::<Diode>(); assert_eq!( confused_d.unwrap_err().to_string(), "value of enum Diode should be represented by either string or table with exactly one key" @@ -120,7 +120,7 @@ inner: let mut cfg = Config::default(); cfg.merge(File::from_str(CFG, FileFormat::Yaml)).unwrap(); - let e = cfg.try_into::<Outer>().unwrap_err(); + let e = cfg.try_deserialize::<Outer>().unwrap_err(); if let ConfigError::Type { key: Some(path), .. } = e diff --git a/tests/legacy/file_ini.rs b/tests/legacy/file_ini.rs index 8f8f88e..d15f5e2 100644 --- a/tests/legacy/file_ini.rs +++ b/tests/legacy/file_ini.rs @@ -34,7 +34,7 @@ fn make() -> Config { #[test] fn test_file() { let c = make(); - let s: Settings = c.try_into().unwrap(); + let s: Settings = c.try_deserialize().unwrap(); assert_eq!( s, Settings { diff --git a/tests/legacy/file_json.rs b/tests/legacy/file_json.rs index b2294b0..3424941 100644 --- a/tests/legacy/file_json.rs +++ b/tests/legacy/file_json.rs @@ -43,7 +43,7 @@ fn test_file() { let c = make(); // Deserialize the entire file as single struct - let s: Settings = c.try_into().unwrap(); + let s: Settings = c.try_deserialize().unwrap(); assert!(s.debug.approx_eq_ulps(&1.0, 2)); assert_eq!(s.production, Some("false".to_string())); diff --git a/tests/legacy/file_ron.rs b/tests/legacy/file_ron.rs index ea8bc27..759a2bf 100644 --- a/tests/legacy/file_ron.rs +++ b/tests/legacy/file_ron.rs @@ -44,7 +44,7 @@ fn test_file() { let c = make(); // Deserialize the entire file as single struct - let s: Settings = c.try_into().unwrap(); + let s: Settings = c.try_deserialize().unwrap(); assert!(s.debug.approx_eq_ulps(&1.0, 2)); assert_eq!(s.production, Some("false".to_string())); diff --git a/tests/legacy/file_toml.rs b/tests/legacy/file_toml.rs index b8a1337..aa4d05f 100644 --- a/tests/legacy/file_toml.rs +++ b/tests/legacy/file_toml.rs @@ -52,7 +52,7 @@ fn test_file() { let c = make(); // Deserialize the entire file as single struct - let s: Settings = c.try_into().unwrap(); + let s: Settings = c.try_deserialize().unwrap(); assert!(s.debug.approx_eq_ulps(&1.0, 2)); assert_eq!(s.production, Some("false".to_string())); diff --git a/tests/legacy/file_yaml.rs b/tests/legacy/file_yaml.rs index 818518b..530e42b 100644 --- a/tests/legacy/file_yaml.rs +++ b/tests/legacy/file_yaml.rs @@ -43,7 +43,7 @@ fn test_file() { let c = make(); // Deserialize the entire file as single struct - let s: Settings = c.try_into().unwrap(); + let s: Settings = c.try_deserialize().unwrap(); assert!(s.debug.approx_eq_ulps(&1.0, 2)); assert_eq!(s.production, Some("false".to_string())); diff --git a/tests/legacy/get.rs b/tests/legacy/get.rs index 061e35e..709d0e9 100644 --- a/tests/legacy/get.rs +++ b/tests/legacy/get.rs @@ -143,7 +143,7 @@ fn test_map_struct() { } let c = make(); - let s: Settings = c.try_into().unwrap(); + let s: Settings = c.try_deserialize().unwrap(); assert_eq!(s.place.len(), 8); assert_eq!( @@ -158,7 +158,7 @@ fn test_file_struct() { let c = make(); // Deserialize the entire file as single struct - let s: Settings = c.try_into().unwrap(); + let s: Settings = c.try_deserialize().unwrap(); assert!(s.debug.approx_eq_ulps(&1.0, 2)); assert_eq!(s.production, Some("false".to_string())); @@ -206,7 +206,7 @@ fn test_struct_array() { } let c = make(); - let s: Settings = c.try_into().unwrap(); + let s: Settings = c.try_deserialize().unwrap(); assert_eq!(s.elements.len(), 10); assert_eq!(s.elements[3], "4".to_string()); @@ -228,7 +228,7 @@ fn test_enum() { } let c = make(); - let s: Settings = c.try_into().unwrap(); + let s: Settings = c.try_deserialize().unwrap(); assert_eq!(s.diodes["green"], Diode::Off); assert_eq!(s.diodes["red"], Diode::Brightness(100)); @@ -263,7 +263,7 @@ fn test_enum_key() { } let c = make(); - let s: Settings = c.try_into().unwrap(); + let s: Settings = c.try_deserialize().unwrap(); assert_eq!(s.proton[&Quark::Up], 2); assert_eq!(s.quarks.len(), 6); @@ -277,7 +277,7 @@ fn test_int_key() { } let c = make(); - let s: Settings = c.try_into().unwrap(); + let s: Settings = c.try_deserialize().unwrap(); assert_eq!(s.divisors[&4], 3); assert_eq!(s.divisors.len(), 4); } diff --git a/tests/weird_keys.rs b/tests/weird_keys.rs index 9c5f1f8..79f3a14 100644 --- a/tests/weird_keys.rs +++ b/tests/weird_keys.rs @@ -22,7 +22,7 @@ where .build(); assert!(cfg.is_ok(), "Config could not be built: {:?}", cfg); - let cfg = cfg.unwrap().try_into(); + let cfg = cfg.unwrap().try_deserialize(); assert!(cfg.is_ok(), "Config could not be transformed: {:?}", cfg); let cfg: T = cfg.unwrap(); |