Skip to content

Commit

Permalink
chore(core): get rid of old is_* methods
Browse files Browse the repository at this point in the history
  • Loading branch information
nerodono committed Jul 17, 2024
1 parent f1a49bb commit de165a3
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 19 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 2 additions & 16 deletions elfo-core/src/actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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());
}
}
4 changes: 2 additions & 2 deletions elfo-core/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@ impl<C, K> Context<C, K> {

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;
Expand Down Expand Up @@ -1033,7 +1033,7 @@ fn e2m<M: Message>(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;
Expand Down
2 changes: 1 addition & 1 deletion elfo-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down

0 comments on commit de165a3

Please sign in to comment.