File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -78,19 +78,21 @@ macro_rules! register_templates {
7878 pub ( crate ) fn $name
7979 $( < $( $lt $( : $clt $( + $dlt ) * + TemplateContext ) ? ) ,+ >) ?
8080 ( templates: & Templates , now: chrono:: DateTime <chrono:: Utc >, rng: & mut impl rand:: Rng )
81- -> anyhow:: Result <( ) > {
81+ -> anyhow:: Result <Vec < String > > {
8282 let locales = templates. translator( ) . available_locales( ) ;
8383 let samples: Vec < $param > = TemplateContext :: sample( now, rng, & locales) ;
8484
8585 let name = $template;
86- for sample in samples {
86+ let mut out = Vec :: new( ) ;
87+ for ( idx, sample) in samples. into_iter( ) . enumerate( ) {
8788 let context = serde_json:: to_value( & sample) ?;
8889 :: tracing:: info!( name, %context, "Rendering template" ) ;
89- templates. $name ( & sample)
90- . with_context( || format!( "Failed to render template {:?} with context {}" , name, context) ) ?;
90+ let rendered = templates. $name ( & sample)
91+ . with_context( || format!( "Failed to render sample template {name:?}-{idx} with context {context}" ) ) ?;
92+ out. push( rendered) ;
9193 }
9294
93- Ok ( ( ) )
95+ Ok ( out )
9496 }
9597 ) *
9698 }
You can’t perform that action at this time.
0 commit comments