From 78884caca030104557ca277dd3a41cefb70f5be8 Mon Sep 17 00:00:00 2001 From: hozan23 Date: Wed, 15 Nov 2023 17:16:39 +0300 Subject: improve the TaskGroup API the TaskGroup now holds an Executor instead of passing it when calling its spawn method also, define a global executor `Executor<'static>` and use static lifetime instead of a lifetime placeholder This improvement simplify the code for spawning a new task. There is no need to pass the executor around. --- core/src/lib.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'core/src/lib.rs') diff --git a/core/src/lib.rs b/core/src/lib.rs index 83af888..fef7459 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -4,7 +4,7 @@ pub mod utils; /// A module containing async utilities that work with the `smol` async runtime. pub mod async_utils; -/// Represents Karyons's Core Error. +/// Represents karyons's Core Error. pub mod error; /// [`EventSys`](./event/struct.EventSys.html) Implementation @@ -13,9 +13,13 @@ pub mod event; /// A simple publish-subscribe system.[`Read More`](./pubsub/struct.Publisher.html) pub mod pubsub; -use error::Result; use smol::Executor as SmolEx; use std::sync::Arc; -/// A wrapper for smol::Executor +/// A pointer to an Executor pub type Executor<'a> = Arc>; + +/// A Global Executor +pub type GlobalExecutor = Arc>; + +use error::Result; -- cgit v1.2.3