pub struct Runtime<'a, S> { /* private fields */ }
Expand description
Implementations§
source§impl<'a> Runtime<'a, SmolScheduler>
impl<'a> Runtime<'a, 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>>, FlowgraphHandle)where
'a: 'b,
pub async fn start<'b>( &'a self, fg: Flowgraph ) -> (TaskHandle<'b, Result<Flowgraph>>, FlowgraphHandle)where 'a: 'b,
sourcepub fn start_sync(
&self,
fg: Flowgraph
) -> (TaskHandle<'_, Result<Flowgraph>>, FlowgraphHandle)
pub fn start_sync( &self, fg: Flowgraph ) -> (TaskHandle<'_, Result<Flowgraph>>, FlowgraphHandle)
sourcepub fn handle(&self) -> RuntimeHandle
pub fn handle(&self) -> RuntimeHandle
Get the RuntimeHandle
Trait Implementations§
Auto Trait Implementations§
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