use std::fmt;
use std::sync::Arc;
use super::RuntimeMode;
use crate::config::XetConfig;
use crate::error::RuntimeError;
#[derive(Debug)]
pub struct XetRuntime {}
impl XetRuntime {
pub fn new(_config: &XetConfig) -> Result<Arc<Self>, RuntimeError> {
Ok(Arc::new(Self {}))
}
pub fn spawn_blocking<F, R>(self: &Arc<Self>, f: F) -> tokio_with_wasm::task::JoinHandle<R>
where
F: FnOnce() -> R + Send + 'static,
R: Send + 'static,
{
tokio_with_wasm::task::spawn_blocking(f)
}
pub fn current_if_exists() -> Option<Arc<Self>> {
None
}
pub fn in_sigint_shutdown(&self) -> bool {
false
}
pub fn external_executor_count(&self) -> usize {
0
}
pub fn perform_sigint_shutdown(&self) {}
pub fn discard_runtime(&self) {}
pub fn mode(&self) -> RuntimeMode {
RuntimeMode::Owned
}
}
impl fmt::Display for XetRuntime {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "wasm runtime (no tokio metrics)")
}
}