///
/// Spawn a process (which contains future + process stack) onto the executor from the global level.
///
/// # Example
/// ```rust
/// use bastion_executor::prelude::*;
/// use lightproc::prelude::*;
///
/// # #[cfg(feature = "tokio-runtime")]
/// # #[tokio::main]
/// # async fn main() {
/// #    start();    
/// # }
/// #
/// # #[cfg(not(feature = "tokio-runtime"))]
/// # fn main() {
/// #    start();    
/// # }
/// #
/// # fn start() {
/// let pid = 1;
/// let stack = ProcStack::default().with_pid(pid);
///
/// let handle = spawn(
///     async {
///         panic!("test");
///     },
///     stack.clone(),
/// );
///
/// run(
///     async {
///         handle.await;
///     },
///     stack.clone(),
/// );
/// # }
/// ```
Spawn a process (which contains future + process stack) onto the executor from the global level.
Spawn a process ( which contains future + process stack ) onto the executor from the global level .
pub fn spawn<F, T>(future: F, stack: ProcStack) -> RecoverableHandle<T>
where
    F: Future<Output = T> + Send + 'static,
    T: Send + 'static,
{
    let (task, handle) = LightProc::recoverable(future, worker::schedule, stack);
    task.schedule();
    handle
}
pub fn spawn < F , T > ( future : F , stack : ProcStack ) -> RecoverableHandle < T > where F : Future < Output = T > + Send + ' static , T : Send + ' static , { let ( task , handle ) = LightProc :: recoverable ( future , worker :: schedule , stack ) ; task . schedule ( ) ; handle }
Spawn a process (which contains future + process stack) onto the executor from the global level.
Spawn a process ( which contains future + process stack ) onto the executor from the global level .
future
F
stack
ProcStack
example
```rust
use bastion_executor::prelude::*;
use lightproc::prelude::*.
` ` ` rust use bastion_executor :: prelude :: * ; use lightproc :: prelude :: * .
#[cfg(feature = "tokio-runtime")]
None
#[tokio::main]
None
async fn main() {
None
start();    
None
}
None
#[cfg(not(feature = "tokio-runtime"))]
None
fn main() {
None
start();    
None
}
None
fn start() {
let pid = 1;
let stack = ProcStack::default().with_pid(pid).

let handle = spawn(
async {
panic!("test");
},
stack.clone(),
).

run(
async {
handle.await;
},
stack.clone(),
).
let pid = 1 ; let stack = ProcStack :: default () . with_pid ( pid ) . let handle = spawn ( async { panic! ( " test " ) ; } stack . clone () ) . run ( async { handle . await ; } stack . clone () ) .
}
None