1
0
mirror of https://github.com/actix/actix-website synced 2024-11-23 16:31:08 +01:00

docs: remove actix_rt references

This commit is contained in:
Rob Ede 2024-06-01 16:09:51 +01:00
parent ad4aeac34f
commit d0f91408ed
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933
4 changed files with 15 additions and 11 deletions

View File

@ -3,6 +3,9 @@ title: Getting Started
slug: /actix/getting-started slug: /actix/getting-started
--- ---
import RenderCodeBlock from '@theme/CodeBlock';
import vars from "@site/vars";
# Getting Started # Getting Started
Lets create and run our first actix application. Well create a new Cargo project that depends on actix and then run the application. Lets create and run our first actix application. Well create a new Cargo project that depends on actix and then run the application.
@ -20,11 +23,11 @@ cd actor-ping
Now, add actix as a dependency of your project by ensuring your Cargo.toml contains the following: Now, add actix as a dependency of your project by ensuring your Cargo.toml contains the following:
```toml <RenderCodeBlock className="language-toml">
[dependencies] {`[dependencies]
actix = "0.11.0" actix = "${vars.actorsMajorVersion}"
actix-rt = "2.2" # <-- Runtime for actix `}
``` </RenderCodeBlock>
Let's create an actor that will accept a `Ping` message and respond with the number of pings processed. Let's create an actor that will accept a `Ping` message and respond with the number of pings processed.
@ -76,10 +79,10 @@ All communication with actors goes through an address. You can `do_send` a messa
In the following example we are going to create a `MyActor` actor and send one message. In the following example we are going to create a `MyActor` actor and send one message.
Here we use the actix-rt as way to start our System and drive our main Future so we can easily `.await` for the messages sent to the Actor. Here we use the `#[actix::main]` as way to start our System and drive our main Future so we can easily `.await` for the messages sent to the Actor.
```rust ```rust
#[actix_rt::main] #[actix::main]
async fn main() { async fn main() {
// start new actor // start new actor
let addr = MyActor { count: 10 }.start(); let addr = MyActor { count: 10 }.start();
@ -95,6 +98,6 @@ async fn main() {
} }
``` ```
`#[actix_rt::main]` starts the system and block until future resolves. `#[actix::main]` starts the system and block until future resolves.
The Ping example is available in the [examples directory](https://github.com/actix/actix/tree/master/actix/examples/). The Ping example is available in the [examples directory](https://github.com/actix/actix/tree/master/actix/examples/).

View File

@ -107,7 +107,7 @@ impl Handler<Ping> for MyActor {
} }
} }
#[actix_rt::main] #[actix::main]
async fn main() { async fn main() {
// Start MyActor in current thread // Start MyActor in current thread
let addr = MyActor.start(); let addr = MyActor.start();
@ -191,7 +191,7 @@ impl Handler<Messages> for MyActor {
} }
} }
#[actix_rt::main] #[actix::main]
async fn main() { async fn main() {
// Start MyActor in current thread // Start MyActor in current thread
let addr = MyActor.start(); let addr = MyActor.start();

View File

@ -83,7 +83,7 @@ impl Handler<Ping> for MyActor {
} }
} }
#[actix_rt::main] #[actix::main]
async fn main() { async fn main() {
// start new actor // start new actor
let addr = MyActor { count: 10 }.start(); let addr = MyActor { count: 10 }.start();

View File

@ -2,6 +2,7 @@ const vars = {
rustVersion: "1.72", rustVersion: "1.72",
actixWebMajorVersion: "4", actixWebMajorVersion: "4",
tokioMajorVersion: "1", tokioMajorVersion: "1",
actorsMajorVersion: "0.13",
}; };
export default vars; export default vars;