diff options
author | hozan23 <hozan23@proton.me> | 2023-12-02 05:10:33 +0300 |
---|---|---|
committer | hozan23 <hozan23@proton.me> | 2023-12-02 05:10:33 +0300 |
commit | 8cdc44b24724acf7dd458e59f5ceed4af04574be (patch) | |
tree | 1e0aad5a905508c54f7d9be4d4b800b7e8f7d532 /core/src | |
parent | 5111a3d5749625c3d8e26a24a5a32c4da58f18d3 (diff) |
Ensure uniform usage of the name `karyon` across all files
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/async_util/backoff.rs | 2 | ||||
-rw-r--r-- | core/src/async_util/condvar.rs | 2 | ||||
-rw-r--r-- | core/src/async_util/condwait.rs | 2 | ||||
-rw-r--r-- | core/src/async_util/select.rs | 2 | ||||
-rw-r--r-- | core/src/async_util/task_group.rs | 2 | ||||
-rw-r--r-- | core/src/async_util/timeout.rs | 2 | ||||
-rw-r--r-- | core/src/event.rs | 2 | ||||
-rw-r--r-- | core/src/executor.rs | 28 | ||||
-rw-r--r-- | core/src/lib.rs | 2 | ||||
-rw-r--r-- | core/src/pubsub.rs | 2 |
10 files changed, 9 insertions, 37 deletions
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::<String>(); 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<T> = HashMap<T, HashMap<String, HashMap<EventListenerID, Sender<E /// # Example /// /// ``` -/// use karyons_core::event::{EventSys, EventValueTopic, EventValue}; +/// use karyon_core::event::{EventSys, EventValueTopic, EventValue}; /// /// async { /// let event_sys = EventSys::new(); diff --git a/core/src/executor.rs b/core/src/executor.rs deleted file mode 100644 index 136f6ea..0000000 --- a/core/src/executor.rs +++ /dev/null @@ -1,28 +0,0 @@ - - -/// Returns an estimate of the default amount of parallelism a program should use. -/// see `std::thread::available_parallelism` -fn available_parallelism() -> usize { - thread::available_parallelism() - .map(NonZeroUsize::get) - .unwrap_or(1) -} - -/// Run a multi-threaded executor -pub fn run_executor<T>(main_future: impl Future<Output = T>, 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(); |