1
1
use rocket:: { Rocket , Build , Orbit } ;
2
2
use rocket:: fairing:: { self , Fairing , Info , Kind } ;
3
+ use rocket:: figment:: { Source , value:: magic:: RelativePathBuf } ;
3
4
4
5
use crate :: context:: { Callback , Context , ContextManager } ;
5
6
use crate :: template:: DEFAULT_TEMPLATE_DIR ;
@@ -31,8 +32,6 @@ impl Fairing for TemplateFairing {
31
32
/// template engines. In debug mode, the `ContextManager::new` method
32
33
/// initializes a directory watcher for auto-reloading of templates.
33
34
async fn on_ignite ( & self , rocket : Rocket < Build > ) -> fairing:: Result {
34
- use rocket:: figment:: value:: magic:: RelativePathBuf ;
35
-
36
35
let configured_dir = rocket. figment ( )
37
36
. extract_inner :: < RelativePathBuf > ( "template_dir" )
38
37
. map ( |path| path. relative ( ) ) ;
@@ -55,14 +54,13 @@ impl Fairing for TemplateFairing {
55
54
}
56
55
57
56
async fn on_liftoff ( & self , rocket : & Rocket < Orbit > ) {
58
- use rocket:: { figment:: Source , yansi:: Paint } ;
59
-
60
57
let cm = rocket. state :: < ContextManager > ( )
61
58
. expect ( "Template ContextManager registered in on_ignite" ) ;
62
59
63
- info ! ( "{}{}:" , "📐 " . emoji( ) , "Templating" . magenta( ) ) ;
64
- info_ ! ( "directory: {}" , Source :: from( & * cm. context( ) . root) . primary( ) ) ;
65
- info_ ! ( "engines: {:?}" , Engines :: ENABLED_EXTENSIONS . primary( ) ) ;
60
+ info_span ! ( "templating" [ icon = "📐" ] => {
61
+ info!( directory = %Source :: from( & * cm. context( ) . root) ) ;
62
+ info!( engines = ?Engines :: ENABLED_EXTENSIONS ) ;
63
+ } ) ;
66
64
}
67
65
68
66
#[ cfg( debug_assertions) ]
@@ -72,5 +70,4 @@ impl Fairing for TemplateFairing {
72
70
73
71
cm. reload_if_needed ( & self . callback ) ;
74
72
}
75
-
76
73
}
0 commit comments