Run Session
async fn run_session(session: Session<End>)
- Evaluates a
Session<End>
and blocks until the process terminates.
Example:
let p: Session<End> = step(async move {
sleep(Duration::from_secs(3)).await;
println!("Hello World!");
terminate()
});
run_session(p).await;
Run Session With Result
async fn run_session_with_result<T>(
session: Session<SendValue<T, End>>
) -> T
- Evaluates a
Session<SendValue<T, End>>
and blocks until the process terminates - Returns the result sent by the process
Example:
let p: Session<SendValue<String, End>> = step(async move {
sleep(Duration::from_secs(3)).await;
send_value("Hello World!".to_string(), terminate())
});
let res = run_session_with_result(p).await;
println!("{}", res);