1- extern crate reqwest;
2- extern crate serde_json;
3- #[ macro_use]
4- extern crate rocket;
5- extern crate rust_team_data;
6- extern crate sass_rs;
7- extern crate siphasher;
8- extern crate toml;
9-
10- #[ macro_use]
11- extern crate serde;
12-
13- extern crate fluent_bundle;
14- extern crate regex;
15-
161mod cache;
172mod caching;
183mod category;
@@ -24,9 +9,12 @@ mod teams;
249
2510use cache:: Cache ;
2611use cache:: Cached ;
12+ use rocket:: catch;
13+ use rocket:: get;
2714use rocket:: tokio:: sync:: RwLock ;
2815use rust_version:: RustReleasePost ;
2916use rust_version:: RustVersion ;
17+ use serde:: Serialize ;
3018use teams:: encode_zulip_stream;
3119use teams:: RustTeams ;
3220
@@ -76,7 +64,7 @@ static ROBOTS_TXT_DISALLOW_ALL: LazyLock<bool> =
7664 LazyLock :: new ( || env:: var ( "ROBOTS_TXT_DISALLOW_ALL" ) . is_ok ( ) ) ;
7765
7866#[ derive( Serialize ) ]
79- struct Context < T : :: serde :: Serialize > {
67+ struct Context < T : Serialize > {
8068 page : String ,
8169 title : String ,
8270 parent : & ' static str ,
@@ -90,7 +78,7 @@ struct Context<T: ::serde::Serialize> {
9078 is_translation : bool ,
9179}
9280
93- impl < T : :: serde :: Serialize > Context < T > {
81+ impl < T : Serialize > Context < T > {
9482 fn new ( page : & str , title_id : & str , is_landing : bool , data : T , lang : String ) -> Self {
9583 let helper = create_loader ( ) ;
9684 let title = if title_id. is_empty ( ) {
@@ -430,7 +418,7 @@ fn render_subject(category: Category, subject: &str, lang: String) -> Result<Tem
430418 Ok ( Template :: render ( page, context) )
431419}
432420
433- #[ launch]
421+ #[ rocket :: launch]
434422async fn rocket ( ) -> _ {
435423 let templating = Template :: custom ( |engine| {
436424 engine
@@ -456,7 +444,7 @@ async fn rocket() -> _ {
456444 . manage ( Arc :: new ( RwLock :: new ( teams) ) )
457445 . mount (
458446 "/" ,
459- routes ! [
447+ rocket :: routes![
460448 index,
461449 category_en,
462450 governance,
@@ -475,6 +463,6 @@ async fn rocket() -> _ {
475463 )
476464 . register (
477465 "/" ,
478- catchers ! [ not_found, unprocessable_content, catch_error] ,
466+ rocket :: catchers![ not_found, unprocessable_content, catch_error] ,
479467 )
480468}
0 commit comments