File tree 1 file changed +26
-0
lines changed
rust-code-analysis-web/src/web
1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -218,6 +218,32 @@ async fn ping() -> HttpResponse {
218
218
HttpResponse :: Ok ( ) . body ( ( ) )
219
219
}
220
220
221
+ /// Runs an HTTP Server which provides a series of services.
222
+ ///
223
+ /// Each service corresponds to a functionality of the main library and can be
224
+ /// accessed through a different route.
225
+ ///
226
+ /// # Examples
227
+ ///
228
+ /// ```
229
+ /// use rust_code_analysis_web::server::run;
230
+ ///
231
+ /// let host = "127.0.0.1";
232
+ /// let port = 8080;
233
+ /// let num_threads = 4;
234
+ ///
235
+ /// // Runs a server on a determined host with a specific port and using certain
236
+ /// // number of threads.
237
+ /// // If the server runs correctly, it will be immediately interrupted,
238
+ /// // otherwise an error will be shown.
239
+ /// match run(&host, port, num_threads).await {
240
+ /// Ok(_) => std::process::exit(0),
241
+ /// Err(e) => eprintln!(
242
+ /// "Cannot run the server at {}:{}: {}",
243
+ /// host, port, e
244
+ /// ),
245
+ /// }
246
+ /// ```
221
247
pub async fn run ( host : & str , port : u16 , n_threads : usize ) -> std:: io:: Result < ( ) > {
222
248
let max_size = 1024 * 1024 * 4 ;
223
249
You can’t perform that action at this time.
0 commit comments