Skip to main content

spawn_coroutine_with_buffer_and_context

Function spawn_coroutine_with_buffer_and_context 

Source
pub fn spawn_coroutine_with_buffer_and_context<T, C, F, Fut>(
    context: C,
    buffer: usize,
    f: F,
) -> CommunicationTask<T>
where F: FnMut(&mut C, T) -> Fut + Send + 'static, Fut: Future<Output = ()> + Send + 'static, C: Send + 'static, T: Send + 'static,
Expand description

Spawns a new asynchronous task with provided context that accepts messages to the task with a set buffer. This function returns a handle that allows sending a message, or if there is no reference to the handle at all (in other words, all handles are dropped), the task would be aborted.