File tree 8 files changed +16
-16
lines changed 8 files changed +16
-16
lines changed Original file line number Diff line number Diff line change @@ -211,8 +211,8 @@ impl Config {
211
211
}
212
212
}
213
213
214
- pub fn get_str ( & self , key : & str ) -> Result < String > {
215
- self . get ( key) . and_then ( Value :: into_str )
214
+ pub fn get_string ( & self , key : & str ) -> Result < String > {
215
+ self . get ( key) . and_then ( Value :: into_string )
216
216
}
217
217
218
218
pub fn get_int ( & self , key : & str ) -> Result < i64 > {
Original file line number Diff line number Diff line change @@ -89,12 +89,12 @@ impl<'de> de::Deserializer<'de> for Value {
89
89
90
90
#[ inline]
91
91
fn deserialize_str < V : de:: Visitor < ' de > > ( self , visitor : V ) -> Result < V :: Value > {
92
- visitor. visit_string ( self . into_str ( ) ?)
92
+ visitor. visit_string ( self . into_string ( ) ?)
93
93
}
94
94
95
95
#[ inline]
96
96
fn deserialize_string < V : de:: Visitor < ' de > > ( self , visitor : V ) -> Result < V :: Value > {
97
- visitor. visit_string ( self . into_str ( ) ?)
97
+ visitor. visit_string ( self . into_string ( ) ?)
98
98
}
99
99
100
100
#[ inline]
@@ -421,12 +421,12 @@ impl<'de> de::Deserializer<'de> for Config {
421
421
422
422
#[ inline]
423
423
fn deserialize_str < V : de:: Visitor < ' de > > ( self , visitor : V ) -> Result < V :: Value > {
424
- visitor. visit_string ( self . cache . into_str ( ) ?)
424
+ visitor. visit_string ( self . cache . into_string ( ) ?)
425
425
}
426
426
427
427
#[ inline]
428
428
fn deserialize_string < V : de:: Visitor < ' de > > ( self , visitor : V ) -> Result < V :: Value > {
429
- visitor. visit_string ( self . cache . into_str ( ) ?)
429
+ visitor. visit_string ( self . cache . into_string ( ) ?)
430
430
}
431
431
432
432
#[ inline]
Original file line number Diff line number Diff line change @@ -286,9 +286,9 @@ impl Value {
286
286
}
287
287
}
288
288
289
- /// Returns `self` into a str , if possible.
289
+ /// Returns `self` into a string , if possible.
290
290
// FIXME: Should this not be `try_into_*` ?
291
- pub fn into_str ( self ) -> Result < String > {
291
+ pub fn into_string ( self ) -> Result < String > {
292
292
match self . kind {
293
293
ValueKind :: String ( value) => Ok ( value) ,
294
294
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ fn test_file() {
60
60
assert_eq ! ( s. elements. len( ) , 10 ) ;
61
61
assert_eq ! ( s. elements[ 3 ] , "4" . to_string( ) ) ;
62
62
assert_eq ! (
63
- s. place. creator[ "name" ] . clone( ) . into_str ( ) . unwrap( ) ,
63
+ s. place. creator[ "name" ] . clone( ) . into_string ( ) . unwrap( ) ,
64
64
"John Smith" . to_string( )
65
65
) ;
66
66
}
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ fn test_file() {
60
60
assert_eq ! ( s. elements. len( ) , 10 ) ;
61
61
assert_eq ! ( s. elements[ 3 ] , "4" . to_string( ) ) ;
62
62
assert_eq ! (
63
- s. place. creator[ "name" ] . clone( ) . into_str ( ) . unwrap( ) ,
63
+ s. place. creator[ "name" ] . clone( ) . into_string ( ) . unwrap( ) ,
64
64
"John Smith" . to_string( )
65
65
) ;
66
66
}
@@ -98,7 +98,7 @@ fn test_json_vec() {
98
98
99
99
let v = c. get_array ( "WASTE" ) . unwrap ( ) ;
100
100
let mut vi = v. into_iter ( ) ;
101
- assert_eq ! ( vi. next( ) . unwrap( ) . into_str ( ) . unwrap( ) , "example_dir1" ) ;
102
- assert_eq ! ( vi. next( ) . unwrap( ) . into_str ( ) . unwrap( ) , "example_dir2" ) ;
101
+ assert_eq ! ( vi. next( ) . unwrap( ) . into_string ( ) . unwrap( ) , "example_dir1" ) ;
102
+ assert_eq ! ( vi. next( ) . unwrap( ) . into_string ( ) . unwrap( ) , "example_dir2" ) ;
103
103
assert ! ( vi. next( ) . is_none( ) ) ;
104
104
}
Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ fn test_file() {
71
71
assert_eq ! ( s. elements. len( ) , 10 ) ;
72
72
assert_eq ! ( s. elements[ 3 ] , "4" . to_string( ) ) ;
73
73
assert_eq ! (
74
- s. place. creator[ "name" ] . clone( ) . into_str ( ) . unwrap( ) ,
74
+ s. place. creator[ "name" ] . clone( ) . into_string ( ) . unwrap( ) ,
75
75
"John Smith" . to_string( )
76
76
) ;
77
77
}
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ fn test_file() {
60
60
assert_eq ! ( s. elements. len( ) , 10 ) ;
61
61
assert_eq ! ( s. elements[ 3 ] , "4" . to_string( ) ) ;
62
62
assert_eq ! (
63
- s. place. creator[ "name" ] . clone( ) . into_str ( ) . unwrap( ) ,
63
+ s. place. creator[ "name" ] . clone( ) . into_string ( ) . unwrap( ) ,
64
64
"John Smith" . to_string( )
65
65
) ;
66
66
}
Original file line number Diff line number Diff line change @@ -111,7 +111,7 @@ fn test_map() {
111
111
112
112
assert_eq ! ( m. len( ) , 8 ) ;
113
113
assert_eq ! (
114
- m[ "name" ] . clone( ) . into_str ( ) . unwrap( ) ,
114
+ m[ "name" ] . clone( ) . into_string ( ) . unwrap( ) ,
115
115
"Torre di Pisa" . to_string( )
116
116
) ;
117
117
assert_eq ! ( m[ "reviews" ] . clone( ) . into_int( ) . unwrap( ) , 3866 ) ;
@@ -138,7 +138,7 @@ fn test_map_struct() {
138
138
139
139
assert_eq ! ( s. place. len( ) , 8 ) ;
140
140
assert_eq ! (
141
- s. place[ "name" ] . clone( ) . into_str ( ) . unwrap( ) ,
141
+ s. place[ "name" ] . clone( ) . into_string ( ) . unwrap( ) ,
142
142
"Torre di Pisa" . to_string( )
143
143
) ;
144
144
assert_eq ! ( s. place[ "reviews" ] . clone( ) . into_int( ) . unwrap( ) , 3866 ) ;
You can’t perform that action at this time.
0 commit comments