Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions Cargo.lock

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

5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ resolver = "3"
members = [
"rt",
"concurrency",
"macros",
"examples/bank",
"examples/bank_threads",
"examples/name_server",
Expand All @@ -15,11 +16,15 @@ members = [
"examples/busy_genserver_warning",
"examples/signal_test",
"examples/signal_test_threads",
"examples/chat_room",
"examples/chat_room_threads",
"examples/service_discovery",
]

[workspace.dependencies]
spawned-rt = { path = "rt", version = "0.4.5" }
spawned-concurrency = { path = "concurrency", version = "0.4.5" }
spawned-macros = { path = "macros", version = "0.4.5" }
tracing = { version = "0.1.41", features = ["log"] }
tracing-subscriber = { version = "0.3.19", features = ["env-filter"] }

Expand Down
1 change: 1 addition & 0 deletions concurrency/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ license.workspace = true

[dependencies]
spawned-rt = { workspace = true }
spawned-macros = { workspace = true }
tracing = { workspace = true }
futures = "0.3.1"
thiserror = "2.0.12"
Expand Down
20 changes: 6 additions & 14 deletions concurrency/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,28 +1,20 @@
#[derive(Debug, thiserror::Error)]
pub enum ActorError {
#[error("Callback Error")]
Callback,
#[error("Initialization error")]
Initialization,
#[error("Server error")]
Server,
#[error("Unsupported Request on this Actor")]
RequestUnused,
#[error("Unsupported Message on this Actor")]
MessageUnused,
#[error("Actor stopped")]
ActorStopped,
#[error("Request to Actor timed out")]
RequestTimeout,
}

impl<T> From<spawned_rt::threads::mpsc::SendError<T>> for ActorError {
fn from(_value: spawned_rt::threads::mpsc::SendError<T>) -> Self {
Self::Server
Self::ActorStopped
}
}

impl<T> From<spawned_rt::tasks::mpsc::SendError<T>> for ActorError {
fn from(_value: spawned_rt::tasks::mpsc::SendError<T>) -> Self {
Self::Server
Self::ActorStopped
}
}

Expand All @@ -32,7 +24,7 @@ mod tests {

#[test]
fn test_error_into_std_error() {
let error: &dyn std::error::Error = &ActorError::Callback;
assert_eq!(error.to_string(), "Callback Error");
let error: &dyn std::error::Error = &ActorError::ActorStopped;
assert_eq!(error.to_string(), "Actor stopped");
}
}
5 changes: 2 additions & 3 deletions concurrency/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//! spawned concurrency
//! Some basic traits and structs to implement concurrent code à-la-Erlang.
pub mod error;
pub mod messages;
pub mod message;
pub mod registry;
pub mod tasks;
pub mod threads;
Loading