mirror of
https://github.com/actix/actix-website
synced 2024-11-23 16:31:08 +01:00
Fix sec-3-address.md run failed issue (#357)
The example run failed with below issue ``` `spawn_local` called from outside of a `task::LocalSet` note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ```
This commit is contained in:
parent
8c33e4bf35
commit
4d2b9670b1
@ -145,14 +145,14 @@ impl Handler<OrderShipped> for SmsSubscriber {
|
||||
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let system = System::new("events");
|
||||
let email_subscriber = Subscribe(EmailSubscriber{}.start().recipient());
|
||||
let sms_subscriber = Subscribe(SmsSubscriber{}.start().recipient());
|
||||
#[actix::main]
|
||||
async fn main() -> Result<(), actix::MailboxError> {
|
||||
let email_subscriber = Subscribe(EmailSubscriber {}.start().recipient());
|
||||
let sms_subscriber = Subscribe(SmsSubscriber {}.start().recipient());
|
||||
let order_event = OrderEvents::new().start();
|
||||
order_event.do_send(email_subscriber);
|
||||
order_event.do_send(sms_subscriber);
|
||||
order_event.do_send(Ship(1));
|
||||
system.run();
|
||||
order_event.send(email_subscriber).await?;
|
||||
order_event.send(sms_subscriber).await?;
|
||||
order_event.send(Ship(1)).await?;
|
||||
Ok(())
|
||||
}
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user