@@ -240,17 +240,39 @@ impl Config {
240
240
}
241
241
242
242
/// Get the table associated with a particular renderer.
243
+ #[ deprecated = "prefer get_renderer_deserialized over get_renderer" ]
243
244
pub fn get_renderer < I : AsRef < str > > ( & self , index : I ) -> Option < & Table > {
244
245
let key = format ! ( "output.{}" , index. as_ref( ) ) ;
245
246
self . get ( & key) . and_then ( Value :: as_table)
246
247
}
247
248
249
+ /// Convenience function to fetch the renderer section from the config and deserialize it
250
+ /// into some arbitrary type.
251
+ pub fn get_renderer_deserialized < ' de , T : Deserialize < ' de > , I : AsRef < str > > (
252
+ & self ,
253
+ index : I ,
254
+ ) -> Result < Option < T > > {
255
+ let key = format ! ( "output.{}" , index. as_ref( ) ) ;
256
+ self . get_deserialized_opt ( key)
257
+ }
258
+
248
259
/// Get the table associated with a particular preprocessor.
260
+ #[ deprecated = "prefer get_preprocessor_deserialized over get_preprocessor" ]
249
261
pub fn get_preprocessor < I : AsRef < str > > ( & self , index : I ) -> Option < & Table > {
250
262
let key = format ! ( "preprocessor.{}" , index. as_ref( ) ) ;
251
263
self . get ( & key) . and_then ( Value :: as_table)
252
264
}
253
265
266
+ /// Convenience function to fetch the preprocessor section from the config and deserialize it
267
+ /// into some arbitrary type.
268
+ pub fn get_preprocessor_deserialized < ' de , T : Deserialize < ' de > , I : AsRef < str > > (
269
+ & self ,
270
+ index : I ,
271
+ ) -> Result < Option < T > > {
272
+ let key = format ! ( "preprocessor.{}" , index. as_ref( ) ) ;
273
+ self . get_deserialized_opt ( key)
274
+ }
275
+
254
276
fn from_legacy ( mut table : Value ) -> Config {
255
277
let mut cfg = Config :: default ( ) ;
256
278
0 commit comments