Struct show_image::ContextHandle[][src]

pub struct ContextHandle<'a> { /* fields omitted */ }
Expand description

Handle to the global context.

You can interact with the global context through a ContextHandle only from the global context thread. To interact with the context from a different thread, use a ContextProxy.

Implementations

impl<'a> ContextHandle<'a>[src]

pub fn proxy(&self) -> ContextProxy[src]

Get a proxy for the context to interact with it from a different thread.

You should not use proxy objects from withing the global context thread. The proxy objects often wait for the global context to perform some action. Doing so from within the global context thread would cause a deadlock.

pub fn set_exit_with_last_window(&mut self, exit_with_last_window: bool)[src]

Exit the program when the last window closes.

pub fn create_window(
    &mut self,
    title: impl Into<String>,
    options: WindowOptions
) -> Result<WindowHandle<'_>, CreateWindowError>
[src]

Create a new window.

pub fn destroy_window(
    &mut self,
    window_id: WindowId
) -> Result<(), InvalidWindowId>
[src]

Destroy a window.

pub fn window_image_info(
    &self,
    window_id: WindowId
) -> Result<Option<(ImageInfo, Rectangle)>, InvalidWindowId>
[src]

Get the image info and the area where the image is drawn for a window.

pub fn set_window_visible(
    &mut self,
    window_id: WindowId,
    visible: bool
) -> Result<(), InvalidWindowId>
[src]

Make a window visible or invisible.

pub fn set_window_options<F>(
    &mut self,
    window_id: WindowId,
    make_options: F
) -> Result<(), InvalidWindowId> where
    F: FnOnce(&WindowOptions) -> WindowOptions
[src]

Change the options of a window.

pub fn set_window_image(
    &mut self,
    window_id: WindowId,
    name: impl Into<String>,
    image: &impl AsImageView
) -> Result<(), SetImageError>
[src]

Set the image to be displayed on a window.

pub fn add_window_overlay(
    &mut self,
    window_id: WindowId,
    name: impl Into<String>,
    image: &impl AsImageView
) -> Result<(), SetImageError>
[src]

Add an overlay to a window.

Overlays are drawn on top of the image. Overlays remain active until you call they are cleared.

pub fn clear_window_overlays(
    &mut self,
    window_id: WindowId
) -> Result<(), InvalidWindowId>
[src]

Clear the overlays of a window.

pub fn add_event_handler<F>(&mut self, handler: F) where
    F: 'static + FnMut(&mut ContextHandle<'_>, &mut Event, &mut EventHandlerControlFlow), 
[src]

Add a global event handler.

pub fn add_window_event_handler<F>(
    &mut self,
    window_id: WindowId,
    handler: F
) -> Result<(), InvalidWindowId> where
    F: 'static + FnMut(&mut WindowHandle<'_>, &mut WindowEvent, &mut EventHandlerControlFlow), 
[src]

Add a window-specific event handler.

pub fn run_background_task<F>(&mut self, task: F) where
    F: FnOnce() + Send + 'static, 
[src]

Run a task in a background thread and register it with the context.

The task will be executed in a different thread than the context. Currently, each task is spawned in a separate thread. In the future, tasks may be run in a dedicated thread pool.

The background task will be joined before the process is terminated when you use Self::exit() or one of the other exit functions of this crate.

pub fn exit(&mut self, code: i32) -> ![src]

Join all background tasks and then exit the process.

If you use std::process::exit, running background tasks may be killed. To ensure no data loss occurs, you should use this function instead.

Background tasks are spawned when an image is saved through the built-in Ctrl+S or Ctrl+Shift+S shortcut, or by user code.

Auto Trait Implementations

impl<'a> !RefUnwindSafe for ContextHandle<'a>

impl<'a> !Send for ContextHandle<'a>

impl<'a> !Sync for ContextHandle<'a>

impl<'a> Unpin for ContextHandle<'a>

impl<'a> !UnwindSafe for ContextHandle<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> Downcast<T> for T

pub fn downcast(&self) -> &T

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T> Instrument for T[src]

fn instrument(self, span: Span) -> Instrumented<Self>[src]

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

fn in_current_span(self) -> Instrumented<Self>[src]

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Pointable for T

pub const ALIGN: usize

The alignment of pointer.

type Init = T

The type for initializers.

pub unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more

pub unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more

pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more

pub unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<T> Upcast<T> for T

pub fn upcast(&self) -> Option<&T>

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

pub fn vzip(self) -> V