@@ -60,7 +60,7 @@ fn hb_month_helper<'a>(
60
60
_b : & Handlebars ,
61
61
_ctx : & Context ,
62
62
_rc : & mut RenderContext ,
63
- out : & mut Output ,
63
+ out : & mut dyn Output ,
64
64
) -> HelperResult {
65
65
let num: u32 = h
66
66
. param ( 0 )
@@ -90,7 +90,7 @@ fn hb_month_helper<'a>(
90
90
}
91
91
92
92
impl Blog {
93
- fn new < T > ( out_directory : T , posts_directory : T ) -> Result < Blog , Box < Error > >
93
+ fn new < T > ( out_directory : T , posts_directory : T ) -> Result < Blog , Box < dyn Error > >
94
94
where
95
95
T : Into < PathBuf > ,
96
96
{
@@ -111,7 +111,7 @@ impl Blog {
111
111
} )
112
112
}
113
113
114
- fn load_posts ( dir : PathBuf ) -> Result < Vec < Post > , Box < Error > > {
114
+ fn load_posts ( dir : PathBuf ) -> Result < Vec < Post > , Box < dyn Error > > {
115
115
let mut posts = Vec :: new ( ) ;
116
116
117
117
for entry in fs:: read_dir ( dir) ? {
@@ -209,7 +209,7 @@ impl Blog {
209
209
Ok ( posts)
210
210
}
211
211
212
- fn render ( & self ) -> Result < ( ) , Box < Error > > {
212
+ fn render ( & self ) -> Result < ( ) , Box < dyn Error > > {
213
213
// make sure our output directory exists
214
214
fs:: create_dir_all ( & self . out_directory ) ?;
215
215
@@ -253,7 +253,7 @@ impl Blog {
253
253
fs:: write ( "./static/styles/vendor.css" , & concatted) . expect ( "couldn't write vendor css" ) ;
254
254
}
255
255
256
- fn render_index ( & self ) -> Result < ( ) , Box < Error > > {
256
+ fn render_index ( & self ) -> Result < ( ) , Box < dyn Error > > {
257
257
let data = json ! ( {
258
258
"title" : "The Rust Programming Language Blog" ,
259
259
"parent" : "layout" ,
@@ -265,7 +265,7 @@ impl Blog {
265
265
Ok ( ( ) )
266
266
}
267
267
268
- fn render_posts ( & self ) -> Result < ( ) , Box < Error > > {
268
+ fn render_posts ( & self ) -> Result < ( ) , Box < dyn Error > > {
269
269
for post in & self . posts {
270
270
// first, we create the path
271
271
//let path = PathBuf::from(&self.out_directory);
@@ -292,7 +292,7 @@ impl Blog {
292
292
Ok ( ( ) )
293
293
}
294
294
295
- fn render_feed ( & self ) -> Result < ( ) , Box < Error > > {
295
+ fn render_feed ( & self ) -> Result < ( ) , Box < dyn Error > > {
296
296
let posts: Vec < _ > = self . posts . iter ( ) . by_ref ( ) . take ( 10 ) . collect ( ) ;
297
297
let data =
298
298
json ! ( { "posts" : posts, "feed_updated" : time:: now_utc( ) . rfc3339( ) . to_string( ) } ) ;
@@ -301,7 +301,7 @@ impl Blog {
301
301
Ok ( ( ) )
302
302
}
303
303
304
- fn generate_releases_feed ( & self ) -> Result < ( ) , Box < Error > > {
304
+ fn generate_releases_feed ( & self ) -> Result < ( ) , Box < dyn Error > > {
305
305
let posts = self . posts . clone ( ) ;
306
306
let is_released: Vec < & Post > = posts. iter ( ) . filter ( |post| post. release ) . collect ( ) ;
307
307
let releases: Vec < ReleasePost > = is_released
@@ -322,7 +322,7 @@ impl Blog {
322
322
Ok ( ( ) )
323
323
}
324
324
325
- fn copy_static_files ( & self ) -> Result < ( ) , Box < Error > > {
325
+ fn copy_static_files ( & self ) -> Result < ( ) , Box < dyn Error > > {
326
326
use fs_extra:: dir:: { self , CopyOptions } ;
327
327
328
328
let mut options = CopyOptions :: new ( ) ;
@@ -341,7 +341,7 @@ impl Blog {
341
341
name : & str ,
342
342
template : & str ,
343
343
data : serde_json:: Value ,
344
- ) -> Result < ( ) , Box < Error > > {
344
+ ) -> Result < ( ) , Box < dyn Error > > {
345
345
let out_file = self . out_directory . join ( name) ;
346
346
347
347
let file = File :: create ( out_file) ?;
@@ -352,7 +352,7 @@ impl Blog {
352
352
}
353
353
}
354
354
355
- fn main ( ) -> Result < ( ) , Box < Error > > {
355
+ fn main ( ) -> Result < ( ) , Box < dyn Error > > {
356
356
let blog = Blog :: new ( "site" , "posts" ) ?;
357
357
358
358
blog. render ( ) ?;
0 commit comments