Skip to main content

xet_runtime/core/
runtime.rs

1/// Whether the runtime owns its tokio thread pool or wraps an external handle.
2///
3/// - **`Owned`**: runtime created its own thread pool. Both async bridging ([`XetRuntime::bridge_async`]) and sync
4///   bridging ([`XetRuntime::bridge_sync`]) are supported.
5///
6/// - **`External`**: runtime wraps a caller-provided tokio handle. Async bridging polls the future directly on the
7///   caller's executor. Sync bridging is rejected with [`RuntimeError::InvalidRuntime`].
8#[derive(Clone, Copy, PartialEq, Eq, Debug)]
9pub enum RuntimeMode {
10    Owned,
11    External,
12}
13
14#[cfg(not(target_family = "wasm"))]
15mod native;
16#[cfg(not(target_family = "wasm"))]
17pub use native::XetRuntime;
18
19#[cfg(target_family = "wasm")]
20mod wasm;
21#[cfg(target_family = "wasm")]
22pub use wasm::XetRuntime;