diff --git a/CHANGELOG.md b/CHANGELOG.md index d2025ec6..aed09999 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [#52]: https://github.com/elfo-rs/elfo/issues/52 [#127]: https://github.com/elfo-rs/elfo/pull/127 [#128]: https://github.com/elfo-rs/elfo/pull/128 +[#133]: https://github.com/elfo-rs/elfo/pull/133 ## [0.2.0-alpha.15] - 2024-05-13 ### Added diff --git a/elfo-core/src/actor.rs b/elfo-core/src/actor.rs index afbf33f3..7764852e 100644 --- a/elfo-core/src/actor.rs +++ b/elfo-core/src/actor.rs @@ -272,20 +272,6 @@ impl Actor { self.mailbox.close(scope::trace_id()) } - pub(crate) fn is_initializing(&self) -> bool { - matches!( - self.control.read().status.kind, - ActorStatusKind::Initializing - ) - } - - pub(crate) fn is_terminating(&self) -> bool { - matches!( - self.control.read().status.kind, - ActorStatusKind::Terminating - ) - } - pub(crate) async fn finished(&self) { self.finished.wait().await } @@ -339,8 +325,8 @@ mod tests { let fut = actor.finished(); actor.set_status(ActorStatus::TERMINATED); fut.await; - assert!(actor.control.read().status.is_finished()); + assert!(actor.status_kind().is_finished()); actor.finished().await; - assert!(actor.control.read().status.is_finished()); + assert!(actor.status_kind().is_finished()); } } diff --git a/elfo-core/src/context.rs b/elfo-core/src/context.rs index 91887a75..ef8d870d 100644 --- a/elfo-core/src/context.rs +++ b/elfo-core/src/context.rs @@ -877,7 +877,7 @@ impl Context { if unlikely(self.stage == Stage::PreRecv) { let actor = ward!(self.actor.as_ref().and_then(|o| o.as_actor())); - if actor.is_initializing() { + if actor.status_kind().is_initializing() { actor.set_status(ActorStatus::NORMAL); } self.stage = Stage::Working; @@ -1033,7 +1033,7 @@ fn e2m(envelope: Envelope) -> M { #[cold] fn on_input_closed(stage: &mut Stage, actor: &Actor) { - if !actor.is_terminating() { + if !actor.status_kind().is_terminating() { actor.set_status(ActorStatus::TERMINATING); } *stage = Stage::Closed; diff --git a/elfo-core/src/lib.rs b/elfo-core/src/lib.rs index fe544530..41cc0210 100644 --- a/elfo-core/src/lib.rs +++ b/elfo-core/src/lib.rs @@ -10,9 +10,9 @@ extern crate elfo_utils; extern crate self as elfo_core; // TODO: revise this list -pub use crate::actor_status::{ActorStatus, ActorStatusKind}; pub use crate::{ actor::{ActorMeta, ActorStartCause, ActorStartInfo}, + actor_status::{ActorStatus, ActorStatusKind}, addr::Addr, config::Config, context::{Context, RequestBuilder},