1- use tokio:: fs;
21use anyhow:: Result ;
2+ use tokio:: fs;
33
44async fn download_jar ( res : reqwest:: Response ) -> Result < ( ) > {
55 let bytes = res. bytes ( ) . await ?;
66 fs:: write ( "server.jar" , & bytes) . await ?;
77 Ok ( ( ) )
88}
99
10- async fn download_binary (
11- res : reqwest:: Response ,
12- filename : & str ,
13- ) -> Result < ( ) > {
10+ async fn download_binary ( res : reqwest:: Response , filename : & str ) -> Result < ( ) > {
1411 let bytes = res. bytes ( ) . await ?;
1512 fs:: write ( filename, & bytes) . await ?;
1613
@@ -59,7 +56,10 @@ pub async fn get_geyser(_version: String) -> Result<()> {
5956 download_jar ( res) . await ?;
6057 Ok ( ( ) )
6158 } else {
62- Err ( anyhow:: anyhow!( "Failed to download Geyser: HTTP {}" , res. status( ) ) )
59+ Err ( anyhow:: anyhow!(
60+ "Failed to download Geyser: HTTP {}" ,
61+ res. status( )
62+ ) )
6363 }
6464}
6565
@@ -75,7 +75,10 @@ pub async fn get_nukkit(_version: String) -> Result<()> {
7575 download_jar ( res) . await ?;
7676 Ok ( ( ) )
7777 } else {
78- Err ( anyhow:: anyhow!( "Failed to download Nukkit: HTTP {}" , res. status( ) ) )
78+ Err ( anyhow:: anyhow!(
79+ "Failed to download Nukkit: HTTP {}" ,
80+ res. status( )
81+ ) )
7982 }
8083}
8184
@@ -107,7 +110,10 @@ pub async fn get_gate(_version: String) -> Result<()> {
107110 download_binary ( res, & filename) . await ?;
108111 Ok ( ( ) )
109112 } else {
110- Err ( anyhow:: anyhow!( "Failed to download Gate: HTTP {}" , res. status( ) ) )
113+ Err ( anyhow:: anyhow!(
114+ "Failed to download Gate: HTTP {}" ,
115+ res. status( )
116+ ) )
111117 }
112118}
113119
@@ -150,7 +156,8 @@ pub async fn get_other(software: String, version: String) -> Result<()> {
150156 if res. status ( ) == 404 {
151157 return Err ( anyhow:: anyhow!(
152158 "Version {} not found for {}. Please check if this version exists." ,
153- version, software
159+ version,
160+ software
154161 ) ) ;
155162 } else {
156163 return Err ( anyhow:: anyhow!(
0 commit comments