Skip to content

Commit 87e7e08

Browse files
djmitchetqwewe
authored andcommitted
fix: Use correct spawn invocation in getting-started.mdx
1 parent 7b0b4a8 commit 87e7e08

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/getting-started.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ use kameo::prelude::*;
5959
#[tokio::main] // Mark the entry point as an asynchronous main function
6060
async fn main() -> Result<(), Box<dyn std::error::Error>> { // Use a Result return type for error handling
6161
// Spawn the HelloWorldActor with an unbounded mailbox
62-
let actor_ref = spawn(HelloWorldActor);
62+
let actor_ref = HelloWorldActor::spawn(HelloWorldActor);
6363

6464
// Send a Greet message to the actor
6565
actor_ref
@@ -74,7 +74,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { // Use a Result retu
7474

7575
- **Actor Definition**: The `HelloWorldActor` is a simple actor that does not maintain any state and only prints out the greeting it receives.
7676
- **Message Handling**: The `handle` method asynchronously processes the `Greet` message. It takes ownership of the message and a context parameter, which could be used for more advanced message handling scenarios.
77-
- **Spawning and Messaging**: The `spawn` function creates an instance of the `HelloWorldActor` and returns a reference to it (`actor_ref`). The `tell` method is then used to send a `Greet` message to the actor. The `send` method is awaited to ensure the message is sent to the actors mailbox.
77+
- **Spawning and Messaging**: The `spawn` function creates an instance of the `HelloWorldActor` and returns a reference to it (`actor_ref`). The `tell` method is then used to send a `Greet` message to the actor. The `tell` method is awaited to ensure the message is sent to the actors mailbox.
7878
- **Asynchronous Runtime**: The example uses Tokio as the asynchronous runtime, indicated by the `#[tokio::main]` attribute. This is necessary for running asynchronous Rust code.
7979

8080
---

0 commit comments

Comments
 (0)