use crate::runtime::Runtime;
use crate::runtime::dispatch::DispatcherClient;
use crate::task::{Builtins, Scheduler};
#[derive(Debug, Clone)]
pub struct RuntimeOperations {
dispatcher: DispatcherClient,
}
impl RuntimeOperations {
#[cfg_attr(test, mutants::skip)] pub fn request_stop(&self) {
Scheduler::begin_current_executor_shutdown(&self.dispatcher);
self.dispatcher.stop();
}
}
impl From<&Builtins> for RuntimeOperations {
fn from(builtins: &Builtins) -> Self {
Self {
dispatcher: builtins.scheduler.dispatcher.clone(),
}
}
}
impl From<&Runtime> for RuntimeOperations {
fn from(runtime: &Runtime) -> Self {
Self {
dispatcher: runtime.scheduler().dispatcher.clone(),
}
}
}