From 8cdc44b24724acf7dd458e59f5ceed4af04574be Mon Sep 17 00:00:00 2001 From: hozan23 Date: Sat, 2 Dec 2023 05:10:33 +0300 Subject: Ensure uniform usage of the name `karyon` across all files --- core/src/async_util/backoff.rs | 2 +- core/src/async_util/condvar.rs | 2 +- core/src/async_util/condwait.rs | 2 +- core/src/async_util/select.rs | 2 +- core/src/async_util/task_group.rs | 2 +- core/src/async_util/timeout.rs | 2 +- core/src/event.rs | 2 +- core/src/executor.rs | 28 ---------------------------- core/src/lib.rs | 2 +- core/src/pubsub.rs | 2 +- 10 files changed, 9 insertions(+), 37 deletions(-) delete mode 100644 core/src/executor.rs (limited to 'core/src') diff --git a/core/src/async_util/backoff.rs b/core/src/async_util/backoff.rs index a231229..4a0ab35 100644 --- a/core/src/async_util/backoff.rs +++ b/core/src/async_util/backoff.rs @@ -12,7 +12,7 @@ use smol::Timer; /// # Examples /// /// ``` -/// use karyons_core::async_util::Backoff; +/// use karyon_core::async_util::Backoff; /// /// async { /// let backoff = Backoff::new(300, 3000); diff --git a/core/src/async_util/condvar.rs b/core/src/async_util/condvar.rs index 7396d0d..73e76fc 100644 --- a/core/src/async_util/condvar.rs +++ b/core/src/async_util/condvar.rs @@ -19,7 +19,7 @@ use crate::util::random_16; /// /// use smol::lock::Mutex; /// -/// use karyons_core::async_util::CondVar; +/// use karyon_core::async_util::CondVar; /// /// async { /// diff --git a/core/src/async_util/condwait.rs b/core/src/async_util/condwait.rs index cd4b269..6aa8a3c 100644 --- a/core/src/async_util/condwait.rs +++ b/core/src/async_util/condwait.rs @@ -9,7 +9,7 @@ use super::CondVar; ///``` /// use std::sync::Arc; /// -/// use karyons_core::async_util::CondWait; +/// use karyon_core::async_util::CondWait; /// /// async { /// let cond_wait = Arc::new(CondWait::new()); diff --git a/core/src/async_util/select.rs b/core/src/async_util/select.rs index 8f2f7f6..0977fa9 100644 --- a/core/src/async_util/select.rs +++ b/core/src/async_util/select.rs @@ -12,7 +12,7 @@ use smol::future::Future; /// ``` /// use std::future; /// -/// use karyons_core::async_util::{select, Either}; +/// use karyon_core::async_util::{select, Either}; /// /// async { /// let fut1 = future::pending::(); diff --git a/core/src/async_util/task_group.rs b/core/src/async_util/task_group.rs index 3fc0cb7..7129af2 100644 --- a/core/src/async_util/task_group.rs +++ b/core/src/async_util/task_group.rs @@ -14,7 +14,7 @@ use super::{select, CondWait, Either}; /// /// use std::sync::Arc; /// -/// use karyons_core::async_util::TaskGroup; +/// use karyon_core::async_util::TaskGroup; /// /// async { /// diff --git a/core/src/async_util/timeout.rs b/core/src/async_util/timeout.rs index 6ab35c4..cf3c490 100644 --- a/core/src/async_util/timeout.rs +++ b/core/src/async_util/timeout.rs @@ -13,7 +13,7 @@ use crate::{error::Error, Result}; /// ``` /// use std::{future, time::Duration}; /// -/// use karyons_core::async_util::timeout; +/// use karyon_core::async_util::timeout; /// /// async { /// let fut = future::pending::<()>(); diff --git a/core/src/event.rs b/core/src/event.rs index f2c5510..ef40205 100644 --- a/core/src/event.rs +++ b/core/src/event.rs @@ -24,7 +24,7 @@ type Listeners = HashMap usize { - thread::available_parallelism() - .map(NonZeroUsize::get) - .unwrap_or(1) -} - -/// Run a multi-threaded executor -pub fn run_executor(main_future: impl Future, ex: Executor<'_>) { - let (signal, shutdown) = channel::unbounded::<()>(); - - let num_threads = available_parallelism(); - - Parallel::new() - .each(0..(num_threads), |_| { - future::block_on(ex.run(shutdown.recv())) - }) - // Run the main future on the current thread. - .finish(|| { - future::block_on(async { - main_future.await; - drop(signal); - }) - }); -} diff --git a/core/src/lib.rs b/core/src/lib.rs index a4ea432..442b642 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -5,7 +5,7 @@ pub mod util; /// [`smol`](https://github.com/smol-rs/smol) async runtime. pub mod async_util; -/// Represents karyons's Core Error. +/// Represents karyon's Core Error. pub mod error; /// [`event::EventSys`] implementation. diff --git a/core/src/pubsub.rs b/core/src/pubsub.rs index 306d42f..f5cb69b 100644 --- a/core/src/pubsub.rs +++ b/core/src/pubsub.rs @@ -12,7 +12,7 @@ pub type SubscriptionID = u16; // # Example /// /// ``` -/// use karyons_core::pubsub::{Publisher}; +/// use karyon_core::pubsub::{Publisher}; /// /// async { /// let publisher = Publisher::new(); -- cgit v1.2.3