pub struct Runtime { /* private fields */ }Expand description
The async runtime for ntex
It is a thread local runtime, and cannot be sent to other threads.
Implementations§
Source§impl Runtime
impl Runtime
Sourcepub fn builder() -> RuntimeBuilder
pub fn builder() -> RuntimeBuilder
Create a builder for Runtime.
Sourcepub fn with_current<T, F: FnOnce(&Self) -> T>(f: F) -> T
pub fn with_current<T, F: FnOnce(&Self) -> T>(f: F) -> T
Sourcepub fn spawn<F: Future + 'static>(&self, future: F) -> JoinHandle<F::Output>
pub fn spawn<F: Future + 'static>(&self, future: F) -> JoinHandle<F::Output>
Spawns a new asynchronous task, returning a [Task] for it.
Spawning a task enables the task to execute concurrently to other tasks. There is no guarantee that a spawned task will execute to completion.
Sourcepub unsafe fn spawn_unchecked<F: Future>(
&self,
future: F,
) -> JoinHandle<F::Output>
pub unsafe fn spawn_unchecked<F: Future>( &self, future: F, ) -> JoinHandle<F::Output>
Spawns a new asynchronous task, returning a [Task] for it.
§Safety
The caller should ensure the captured lifetime is long enough.
Sourcepub fn poll(&self) -> PollResult
pub fn poll(&self) -> PollResult
Poll runtime and run active tasks
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Runtime
impl !RefUnwindSafe for Runtime
impl Send for Runtime
impl !Sync for Runtime
impl Unpin for Runtime
impl !UnwindSafe for Runtime
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