Skip to content

Commit

Permalink
fix initial remoteactorsystem examples in code documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
LeonHartley committed Feb 8, 2023
1 parent ef9485d commit 8174bea
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 16 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion coerce/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "coerce"
description = "Async actor runtime and distributed systems framework"
license = "Apache-2.0"
version = "0.8.4"
version = "0.8.5"
authors = ["Leon Hartley <ljph@outlook.com>"]
edition = "2021"
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion coerce/src/actor/message/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//! to the [`ActorSystem`] the actor was spawned into, a means to spawn [`Supervised`] actors and more utilities.
//!
//! ### Example
//! ```rust,no_run
//! ```rust,compile_fail
//! use coerce::actor::Actor;
//! use coerce::actor::message::{Message, Handler};
//! use coerce::actor::context::ActorContext;
Expand Down
35 changes: 25 additions & 10 deletions coerce/src/remote/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,40 @@
//! of defining the message, it must define how to serialise and deserialise to and from a `Vec<u8>`.
//!
//! ```rust
//! use coerce::actor::Actor;
//! use coerce::actor::message::{Message, MessageUnwrapErr, MessageWrapErr};
//! use coerce::actor::{Actor, system::ActorSystem};
//! use coerce::actor::context::ActorContext;
//! use coerce::actor::message::{Handler, Message, MessageUnwrapErr, MessageWrapErr};
//! use coerce::remote::system::RemoteActorSystem;
//! use async_trait::async_trait;
//!
//! let remote_system = RemoteActorSystem::builder()
//! .with_id(1)
//! .with_tag("node_name")
//! .with_actor_system(system)
//! .with_handlers(|handlers| {
//! handlers
//! .with_handler::<MyActorType, MyMessageType>("MyActorType.MyMessageType")
//! });
//! #[tokio::main]
//! pub async fn main() {
//! let system = ActorSystem::new();
//! let remote_system = RemoteActorSystem::builder()
//! .with_id(1)
//! .with_tag("node_name")
//! .with_actor_system(system)
//! .with_handlers(|handlers| {
//! handlers
//! .with_handler::<MyActor, MyMessage>("MyActor.MyMessage")
//! });
//!
//! // start servers, create actors etc
//! }
//!
//! struct MyActor;
//!
//! impl Actor for MyActor { }
//!
//! struct MyMessage;
//!
//! #[async_trait]
//! impl Handler<MyMessage> for MyActor {
//! async fn handle(&mut self, message: MyMessage, ctx: &mut ActorContext) {
//! // handle the msg
//! }
//! }
//!
//! impl Message for MyMessage {
//! type Result = ();
//!
Expand Down

0 comments on commit 8174bea

Please sign in to comment.