mirror of
https://github.com/maplibre/maplibre-rs.git
synced 2025-12-08 19:05:57 +00:00
21 lines
508 B
Rust
21 lines
508 B
Rust
use crate::io::shared_thread_state::SharedThreadState;
|
|
|
|
pub struct TokioScheduleMethod;
|
|
|
|
impl TokioScheduleMethod {
|
|
pub fn new() -> Self {
|
|
Self {}
|
|
}
|
|
|
|
pub fn schedule<T>(
|
|
&self,
|
|
shared_thread_state: SharedThreadState,
|
|
future_factory: impl (FnOnce(SharedThreadState) -> T) + Send + 'static,
|
|
) where
|
|
T: std::future::Future + Send + 'static,
|
|
T::Output: Send + 'static,
|
|
{
|
|
tokio::task::spawn(future_factory(shared_thread_state));
|
|
}
|
|
}
|