-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
42 changed files
with
225 additions
and
169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Actors | ||
|
||
## Stakker | ||
|
||
|
||
## Riker | ||
|
||
[Riker]( https://riker.rs/ ) | ||
|
||
```rust,editable,ignore | ||
struct MyActor; | ||
impl Actor for MyActor { | ||
type Msg = String; | ||
fn recv(&mut self, | ||
ctx: &Context<String>, | ||
msg: String, | ||
sender: Sender) { | ||
println!("received {}", msg); | ||
} | ||
} | ||
fn main() { | ||
let sys = SystemBuilder::new() | ||
.name("my-app") | ||
.create() | ||
.unwrap(); | ||
// Every actor has a name that is required to be unique among its singlings (those actors sharing the same parent actor). | ||
let my_actor = sys.actor_of::<MyActor>("my-actor").unwrap(); | ||
my_actor.tell("Hello!".to_string(), None); | ||
// force main to wait before exiting program | ||
std::thread::sleep(Duration::from_millis(500)); | ||
} | ||
``` | ||
|
||
## Alternatives | ||
|
||
[Actix]( https://github.com/actix/actix ) | ||
|
||
[Ractor]( https://crates.io/crates/ractor ) | ||
|
||
## Utilities | ||
|
||
[Await tree]( https://crates.io/crates/await-tree ) | ||
|
||
## Reference | ||
|
||
[Actors with Tokio]( https://ryhl.io/blog/actors-with-tokio/ ) |
Oops, something went wrong.