Skip to content

Commit 0ff2d55

Browse files
refactor: flatten module structure, remove threads directory [3/8]
Move files from tasks/ to root and remove threads/ directory: - concurrency/src/tasks/* → concurrency/src/* - Delete concurrency/src/threads/ (replaced by Backend enum) - Update all imports from spawned_concurrency::tasks:: to spawned_concurrency:: The Backend enum (Async, Blocking, Thread) now provides all the functionality previously split between tasks and threads modules, offering a cleaner and more unified API. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent ac15511 commit 0ff2d55

File tree

24 files changed

+34
-650
lines changed

24 files changed

+34
-650
lines changed
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
//! GenServer trait and structs to create an abstraction similar to Erlang gen_server.
22
//! See examples/name_server for a usage example.
3-
use crate::{
4-
error::GenServerError,
5-
tasks::InitResult::{NoSuccess, Success},
6-
};
3+
use crate::error::GenServerError;
4+
use InitResult::{NoSuccess, Success};
75
use core::pin::pin;
86
use futures::future::{self, FutureExt as _};
97
use spawned_rt::{
@@ -480,7 +478,7 @@ mod warn_on_block {
480478
mod tests {
481479

482480
use super::*;
483-
use crate::{messages::Unused, tasks::send_after};
481+
use crate::{messages::Unused, send_after};
484482
use std::{
485483
sync::{Arc, Mutex},
486484
thread,

concurrency/src/lib.rs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
11
//! spawned concurrency
22
//! Some basic traits and structs to implement concurrent code à-la-Erlang.
33
pub mod error;
4+
mod gen_server;
45
pub mod messages;
5-
pub mod tasks;
6-
pub mod threads;
6+
mod process;
7+
mod stream;
8+
mod time;
9+
10+
#[cfg(test)]
11+
mod stream_tests;
12+
#[cfg(test)]
13+
mod timer_tests;
14+
15+
pub use error::GenServerError;
16+
pub use gen_server::{
17+
send_message_on, Backend, CallResponse, CastResponse, GenServer, GenServerHandle,
18+
GenServerInMsg, InitResult, InitResult::NoSuccess, InitResult::Success,
19+
};
20+
pub use process::{send, Process, ProcessInfo};
21+
pub use stream::spawn_listener;
22+
pub use time::{send_after, send_interval};
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::tasks::{GenServer, GenServerHandle};
1+
use crate::{GenServer, GenServerHandle};
22
use futures::{future::select, Stream, StreamExt};
33
use spawned_rt::tasks::JoinHandle;
44

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
use crate::tasks::{
2-
send_after, stream::spawn_listener, Backend, CallResponse, CastResponse, GenServer,
3-
GenServerHandle,
1+
use crate::{
2+
send_after, spawn_listener, Backend, CallResponse, CastResponse, GenServer, GenServerHandle,
43
};
54
use futures::{stream, StreamExt};
65
use spawned_rt::tasks::{self as rt, BroadcastStream, ReceiverStream};

concurrency/src/tasks/mod.rs

Lines changed: 0 additions & 20 deletions
This file was deleted.

concurrency/src/threads/gen_server.rs

Lines changed: 0 additions & 217 deletions
This file was deleted.

concurrency/src/threads/mod.rs

Lines changed: 0 additions & 15 deletions
This file was deleted.

concurrency/src/threads/process.rs

Lines changed: 0 additions & 71 deletions
This file was deleted.

0 commit comments

Comments
 (0)