Skip to content

Commit

Permalink
updated version and fixed warning and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
EnvOut committed Apr 17, 2024
1 parent 2169911 commit 83cba86
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

7 changes: 5 additions & 2 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@ run_all_examples:
cargo run --example interval && \
cargo run --example single_channel_actor

publish:
cargo publish -p uactor #--dry-run
run_tests:
cargo test

publish: run_tests run_all_examples
cargo publish -p uactor --allow-dirty
2 changes: 1 addition & 1 deletion src/uactor/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "uactor"
version = "0.8.1"
version = "0.9.1"
edition = "2021"
repository = "https://github.com/EnvOut/uactor"
license = "MIT"
Expand Down
22 changes: 15 additions & 7 deletions src/uactor/src/actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,22 @@ pub trait MessageSender<M> where M: Message {

/// Example:
/// ```
///# use uactor::actor::Actor;
///# use uactor::system::System;
///# let mut system = System::global().build();
///# pub struct Actor1;
///# impl Actor for Actor1 { type Context = (); type Inject = (); }
///# let actor1 = Actor1;
/// let (mut actor1_ref, handle) = uactor::spawn_with_ref!(system, actor1: Actor1);
///# use std::future::Future;
/// use uactor::actor::{Actor, HandleResult};
/// use uactor::context::Context;
/// use uactor::system::System;
/// let mut system = System::global().build();
/// pub struct Actor1;
/// impl Actor for Actor1 { type Context = Context; type Inject = (); }
/// let actor1 = Actor1;
/// use uactor::message::{Message};
/// use uactor::message_impl;
/// pub struct Ping;
/// impl Message for Ping {}
/// impl uactor::actor::Handler<Ping> for Actor1 { async fn handle(&mut self, inject: &mut Self::Inject, msg: Ping, ctx: &mut Self::Context) -> HandleResult { todo!() } }
/// uactor::generate_actor_ref!(Actor1, { });
/// ```
/// let (mut actor1_ref, handle) = uactor::spawn_with_ref!(system, actor1: Actor1);
#[macro_export]
macro_rules! generate_actor_ref {
($ActorType: ident, { $($Message: ident),* }) => {
Expand Down
4 changes: 2 additions & 2 deletions src/uactor/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub trait ActorContext: Sized + Unpin + 'static {
#[inline]
fn on_start(&mut self) -> ContextResult<()> { Ok(()) }
#[inline]
fn on_die(&mut self, actor_name: Arc<str>) -> ContextResult<()> { Ok(()) }
fn on_die(&mut self, _actor_name: Arc<str>) -> ContextResult<()> { Ok(()) }
#[inline]
fn on_iteration(&mut self) -> ContextResult<()> { Ok(()) }
fn kill(&mut self);
Expand Down Expand Up @@ -85,7 +85,7 @@ pub mod supervised {
return Err(msg);
}

let (supervisor) = found_actors.remove(0);
let supervisor = found_actors.remove(0);
Ok(Self {
alive: true,
id: rand::random(),
Expand Down
9 changes: 5 additions & 4 deletions src/uactor/src/di.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ pub enum InjectError {

/// Sample:
/// ```
///# use uactor::di::{Inject, InjectError};
///# use uactor::context::extensions::Service;
/// use uactor::di::{Inject, InjectError};
///# use uactor::system::System;
///
/// pub struct References {
/// var1: String,
/// var2: String,
/// var1: Service<String>,
/// var2: Service<String>,
/// }
///
/// impl Inject for References {
Expand All @@ -27,7 +28,7 @@ pub enum InjectError {
/// {
/// let var1 = system.get_service::<String>()?.clone();
/// let var2 = system.get_service::<String>()?.clone();
/// Ok(Self { var1: var1, var2: var2 })
/// Ok(Self { var1, var2 })
/// }
/// }
/// ```
Expand Down

0 comments on commit 83cba86

Please sign in to comment.