Function show_image::try_run_context_with_local_task[][src]

pub fn try_run_context_with_local_task<F>(user_task: F) -> ! where
    F: FnOnce(Result<&mut ContextHandle<'_>, GetDeviceError>) + Send + 'static, 
Expand description

Initialize and run the global context and run a user task, both in the main thread.

This function is almost identical to run_context_with_local_task, except that it allows the user task to handle initialization errors. If the initialization of the global context fails, the process will terminate when the user task returns. Otherwise, the global context will continue running the event loop in the main thread.

Panics

This function panics if it is called from any thread other than the main thread. Some platforms like OS X require all GUI code to run in the main thread. To ensure portability, this restriction is also enforced on other platforms.