pub struct Runtime<'a, S> { /* private fields */ }
Expand description
Implementations§
Source§impl Runtime<'_, SmolScheduler>
impl Runtime<'_, SmolScheduler>
Sourcepub fn new() -> Self
pub fn new() -> Self
Constructs a new Runtime using SmolScheduler::default() for the Scheduler.
Sourcepub fn with_custom_routes(routes: Router) -> Self
pub fn with_custom_routes(routes: Router) -> Self
Set custom routes for the control port Axum webserver
Source§impl<'a, S: Scheduler + Sync> Runtime<'a, S>
impl<'a, S: Scheduler + Sync> Runtime<'a, S>
Sourcepub fn with_scheduler(scheduler: S) -> Self
pub fn with_scheduler(scheduler: S) -> Self
Sourcepub fn with_config(scheduler: S, routes: Router) -> Self
pub fn with_config(scheduler: S, routes: Router) -> Self
Create runtime with given scheduler and Axum routes
Sourcepub fn spawn<T: Send + 'static>(
&self,
future: impl Future<Output = T> + Send + 'static,
) -> Task<T> ⓘ
pub fn spawn<T: Send + 'static>( &self, future: impl Future<Output = T> + Send + 'static, ) -> Task<T> ⓘ
Spawn task on runtime
Sourcepub fn block_on<T: Send + 'static>(
&self,
future: impl Future<Output = T> + Send + 'static,
) -> T
pub fn block_on<T: Send + 'static>( &self, future: impl Future<Output = T> + Send + 'static, ) -> T
Block thread, waiting for future to complete
Sourcepub fn spawn_background<T: Send + 'static>(
&self,
future: impl Future<Output = T> + Send + 'static,
)
pub fn spawn_background<T: Send + 'static>( &self, future: impl Future<Output = T> + Send + 'static, )
Spawn task on runtime in background, detaching the handle
Sourcepub fn spawn_blocking<T: Send + 'static>(
&self,
future: impl Future<Output = T> + Send + 'static,
) -> Task<T> ⓘ
pub fn spawn_blocking<T: Send + 'static>( &self, future: impl Future<Output = T> + Send + 'static, ) -> Task<T> ⓘ
Spawn a blocking task
This is usually moved in a separate thread.
Sourcepub fn spawn_blocking_background<T: Send + 'static>(
&self,
future: impl Future<Output = T> + Send + 'static,
)
pub fn spawn_blocking_background<T: Send + 'static>( &self, future: impl Future<Output = T> + Send + 'static, )
Spawn a blocking task in the background
Sourcepub async fn start<'b>(
&'a self,
fg: Flowgraph,
) -> (TaskHandle<'b, Result<Flowgraph, Error>>, FlowgraphHandle)where
'a: 'b,
pub async fn start<'b>(
&'a self,
fg: Flowgraph,
) -> (TaskHandle<'b, Result<Flowgraph, Error>>, FlowgraphHandle)where
'a: 'b,
Sourcepub fn start_sync(
&self,
fg: Flowgraph,
) -> (TaskHandle<'_, Result<Flowgraph, Error>>, FlowgraphHandle)
pub fn start_sync( &self, fg: Flowgraph, ) -> (TaskHandle<'_, Result<Flowgraph, Error>>, FlowgraphHandle)
Sourcepub fn handle(&self) -> RuntimeHandle
pub fn handle(&self) -> RuntimeHandle
Get the RuntimeHandle
Trait Implementations§
Source§impl Default for Runtime<'_, SmolScheduler>
impl Default for Runtime<'_, SmolScheduler>
Auto Trait Implementations§
impl<'a, S> Freeze for Runtime<'a, S>where
S: Freeze,
impl<'a, S> !RefUnwindSafe for Runtime<'a, S>
impl<'a, S> Send for Runtime<'a, S>where
S: Send,
impl<'a, S> Sync for Runtime<'a, S>where
S: Sync,
impl<'a, S> Unpin for Runtime<'a, S>where
S: Unpin,
impl<'a, S> !UnwindSafe for Runtime<'a, S>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more