From 9f45cfe49264a45ed964f21d52ad930887978e55 Mon Sep 17 00:00:00 2001 From: memoryruins Date: Thu, 5 Apr 2018 19:12:23 -0400 Subject: [PATCH] Expand note about actix. --- guide/src/qs_2.md | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/guide/src/qs_2.md b/guide/src/qs_2.md index e405775d4..8c061f57f 100644 --- a/guide/src/qs_2.md +++ b/guide/src/qs_2.md @@ -3,7 +3,7 @@ Let’s create and run our first actix web application. We’ll create a new Cargo project that depends on actix web and then run the application. -In the previous section we already installed the required rust version. Now let's create new cargo projects. +In the previous section we already installed the required rust version. Now let's create a new cargo project. ## Hello, world! @@ -24,7 +24,7 @@ actix = "0.5" actix-web = "0.4" ``` -In order to implement a web server, first we need to create a request handler. +In order to implement a web server, we first need to create a request handler. A request handler is a function that accepts an `HttpRequest` instance as its only parameter and returns a type that can be converted into `HttpResponse`: @@ -64,7 +64,7 @@ connections. The server accepts a function that should return an `HttpHandler` i .run(); ``` -That's it. Now, compile and run the program with `cargo run`. +That's it! Now, compile and run the program with `cargo run`. Head over to ``http://localhost:8088/`` to see the results. Here is full source of main.rs file: @@ -80,7 +80,7 @@ fn index(req: HttpRequest) -> &'static str { fn main() { # // In the doctest suite we can't run blocking code - deliberately leak a thread -# // If copying this example in show-all mode make sure you skip the thread spawn +# // If copying this example in show-all mode, make sure you skip the thread spawn # // call. # thread::spawn(|| { HttpServer::new( @@ -92,7 +92,11 @@ fn main() { } ``` -Note on the `actix` crate. Actix web framework is built on top of actix actor library. +> **Note**: actix web is built upon [actix](https://github.com/actix/actix), +> an [actor model](https://en.wikipedia.org/wiki/Actor_model) framework in Rust. + `actix::System` initializes actor system, `HttpServer` is an actor and must run within a -properly configured actix system. For more information please check -[actix documentation](https://actix.github.io/actix/actix/) +properly configured actix system. + +> For more information, check out the [actix documentation](https://actix.github.io/actix/actix/) +> and [actix guide](https://actix.github.io/actix/guide/).