From d0f91408ede3c09de69c8788990a6654f5784c8a Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Sat, 1 Jun 2024 16:09:51 +0100 Subject: [PATCH] docs: remove actix_rt references --- docs/actix/sec-1-getting-started.md | 19 +++++++++++-------- docs/actix/sec-2-actor.md | 4 ++-- docs/actix/sec-4-context.md | 2 +- vars.ts | 1 + 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/docs/actix/sec-1-getting-started.md b/docs/actix/sec-1-getting-started.md index 9009f72..0802ae9 100644 --- a/docs/actix/sec-1-getting-started.md +++ b/docs/actix/sec-1-getting-started.md @@ -3,6 +3,9 @@ title: Getting Started slug: /actix/getting-started --- +import RenderCodeBlock from '@theme/CodeBlock'; +import vars from "@site/vars"; + # Getting Started Let’s create and run our first actix application. We’ll 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: -```toml -[dependencies] -actix = "0.11.0" -actix-rt = "2.2" # <-- Runtime for actix -``` + +{`[dependencies] +actix = "${vars.actorsMajorVersion}" +`} + 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. -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 -#[actix_rt::main] +#[actix::main] async fn main() { // start new actor 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/). diff --git a/docs/actix/sec-2-actor.md b/docs/actix/sec-2-actor.md index 8ad6d3b..9b2bfaf 100644 --- a/docs/actix/sec-2-actor.md +++ b/docs/actix/sec-2-actor.md @@ -107,7 +107,7 @@ impl Handler for MyActor { } } -#[actix_rt::main] +#[actix::main] async fn main() { // Start MyActor in current thread let addr = MyActor.start(); @@ -191,7 +191,7 @@ impl Handler for MyActor { } } -#[actix_rt::main] +#[actix::main] async fn main() { // Start MyActor in current thread let addr = MyActor.start(); diff --git a/docs/actix/sec-4-context.md b/docs/actix/sec-4-context.md index 3d4d135..02a409b 100644 --- a/docs/actix/sec-4-context.md +++ b/docs/actix/sec-4-context.md @@ -83,7 +83,7 @@ impl Handler for MyActor { } } -#[actix_rt::main] +#[actix::main] async fn main() { // start new actor let addr = MyActor { count: 10 }.start(); diff --git a/vars.ts b/vars.ts index ba90fb5..feb1ba3 100644 --- a/vars.ts +++ b/vars.ts @@ -2,6 +2,7 @@ const vars = { rustVersion: "1.72", actixWebMajorVersion: "4", tokioMajorVersion: "1", + actorsMajorVersion: "0.13", }; export default vars;