Skip to content

Commit 5ad86d7

Browse files
committed
fix smol import
1 parent 6255722 commit 5ad86d7

File tree

4 files changed

+103
-15
lines changed

4 files changed

+103
-15
lines changed

Cargo.lock

+90-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/Cargo.toml

+6-5
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,10 @@ default = ["proactor_nuclei", "telemetry_server_builtin", "prometheus_metrics",
3737
proactor_nuclei = ["nuclei/async-exec", "nuclei/iouring"]
3838
# Use the tokio async runtime (proactor_? exclusive one or the other)
3939
proactor_tokio = ["nuclei/tokio", "nuclei/iouring"]
40-
exec_embassy = ["embassy-executor"]
41-
#exec_smol = ["smol"]
40+
4241
exec_async_std = ["async-std"]
42+
exec_embassy = ["embassy-executor"]
43+
exec_smol = ["smol"]
4344

4445
proactor_windows = ["nuclei/async-exec"]
4546

@@ -83,9 +84,9 @@ cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"]
8384

8485
[dependencies]
8586
nuclei = { version = "0.4.4", optional = true } # foundational proactive runtime
86-
embassy-executor = { version = "0.5.0", optional = true }
87-
async-std = { version = "1.13.1", attributes="", optional = true}
88-
#smol = { version = "2.0.2", option = true}
87+
embassy-executor = { version = "0.7.0", optional = true }
88+
async-std = { version = "1.13.1", optional = true, features = ["attributes"]}
89+
smol = { version = "2.0.2", optional = true}
8990
ringbuf = "0.4.7" # foundational bounded message passing
9091
async-ringbuf = "0.3.2" # foundational bounded message passing
9192
log = "0.4.25" # common logging traits

core/src/abstract_executor_embassy.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub(crate) mod core_exec {
1111
use lazy_static::lazy_static;
1212
use parking_lot::Once;
1313
use crate::ProactorConfig;
14-
use embassy_executor::{Executor, Spawner};
14+
use embassy_executor::{Spawner};
1515

1616
/// Spawns a local task intended for lightweight operations.
1717
///

core/src/abstract_executor_smol.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,25 @@ pub(crate) mod core_exec {
1515
use log::{error, trace, warn};
1616
use parking_lot::Once;
1717
use crate::ProactorConfig;
18-
use smol::{spawn, Task, unblock, block_on};
18+
use smol::{Task, unblock};
1919
use std::panic::{catch_unwind, AssertUnwindSafe};
2020

2121
/// Spawns a local task intended for lightweight operations.
2222
///
2323
/// Note: In `smol`, tasks are scheduled on the global executor, which may not guarantee
2424
/// execution on the current thread, unlike `nuclei::spawn_local`.
2525
pub fn spawn_local<F: Future<Output = T> + 'static, T: 'static>(f: F) -> Task<T> {
26-
spawn(f)
26+
smol::spawn(f)
2727
}
2828

2929
/// Spawns a blocking task on a separate thread for CPU-bound or blocking operations.
3030
pub fn spawn_blocking<F: FnOnce() -> T + Send + 'static, T: Send + 'static>(f: F) -> Task<T> {
31-
spawn(unblock(f))
31+
smol::spawn(unblock(f))
3232
}
3333

3434
/// Spawns a task that can run on any thread in the pool for parallel execution.
3535
pub fn spawn<F: Future<Output = T> + Send + 'static, T: Send + 'static>(future: F) -> Task<T> {
36-
spawn(future)
36+
smol::spawn(future)
3737
}
3838

3939
/// Asynchronously spawns additional threads in the executor.
@@ -78,7 +78,8 @@ pub(crate) mod core_exec {
7878

7979
/// Blocks the current thread until the given future completes.
8080
pub fn block_on<F: Future<Output = T>, T>(future: F) -> T {
81-
block_on(future)
81+
82+
smol::block_on(future)
8283
}
8384
}
8485

0 commit comments

Comments
 (0)