Struct kumo_server_runtime::Runtime
source · pub struct Runtime { /* private fields */ }
Implementations§
source§impl Runtime
impl Runtime
pub fn new<F>( name_prefix: &'static str, default_size: F, configured_size: &AtomicUsize, ) -> Result<Self>
pub fn get_num_threads(&self) -> usize
sourcepub async fn spawn<F: FnOnce() -> Result<FUT> + Send + 'static, FUT>(
&self,
name: String,
func: F,
) -> Result<JoinHandle<FUT::Output>>
pub async fn spawn<F: FnOnce() -> Result<FUT> + Send + 'static, FUT>( &self, name: String, func: F, ) -> Result<JoinHandle<FUT::Output>>
Schedule func to run in the runtime pool. func must return a future; that future will be spawned into the thread-local executor. This function will return the result of the spawn attempt, but will not wait for the future it spawns to complete.
This function is useful for getting into a localset environment where !Send futures can be scheduled when you are not already in such an environment.
If you are already in a !Send future, then using spawn_local below has less overhead.
pub fn spawn_non_blocking<F: FnOnce() -> Result<FUT> + Send + 'static, FUT>(
&self,
name: String,
func: F,
) -> Result<()>where
FUT: Future + 'static,
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